var wysihtml5 = {version: "0.3.0", commands: {}, dom: {}, quirks: {}, toolbar: {}, lang: {}, selection: {}, views: {}, INVISIBLE_SPACE: "﻿", EMPTY_FUNCTION: function () {
}, ELEMENT_NODE: 1, TEXT_NODE: 3, BACKSPACE_KEY: 8, ENTER_KEY: 13, ESCAPE_KEY: 27, SPACE_KEY: 32, DELETE_KEY: 46};
window["rangy"] = function () {
    function u(n, r) {
        var i = typeof n[r];
        return i == t || !!(i == e && n[r]) || i == "unknown"
    }

    function a(t, n) {
        return!!(typeof t[n] == e && t[n])
    }

    function f(e, t) {
        return typeof e[t] != n
    }

    function l(e) {
        return function (t, n) {
            var r = n.length;
            while (r--) {
                if (!e(t, n[r])) {
                    return false
                }
            }
            return true
        }
    }

    function d(e) {
        return e && c(e, o) && p(e, s)
    }

    function m(e) {
        window.alert("Rangy not supported in your browser. Reason: " + e);
        v.initialized = true;
        v.supported = false
    }

    function g(e) {
        var t = "Rangy warning: " + e;
        if (v.config.alertOnWarn) {
            window.alert(t)
        } else if (typeof window.console != n && typeof window.console.log != n) {
            window.console.log(t)
        }
    }

    function w() {
        if (v.initialized) {
            return
        }
        var e;
        var t = false, n = false;
        if (u(document, "createRange")) {
            e = document.createRange();
            if (c(e, i) && p(e, r)) {
                t = true
            }
            e.detach()
        }
        var s = a(document, "body") ? document.body : document.getElementsByTagName("body")[0];
        if (s && u(s, "createTextRange")) {
            e = s.createTextRange();
            if (d(e)) {
                n = true
            }
        }
        if (!t && !n) {
            m("Neither Range nor TextRange are implemented")
        }
        v.initialized = true;
        v.features = {implementsDomRange: t, implementsTextRange: n};
        var o = b.concat(y);
        for (var f = 0, l = o.length; f < l; ++f) {
            try {
                o[f](v)
            } catch (h) {
                if (a(window, "console") && u(window.console, "log")) {
                    window.console.log("Init listener threw an exception. Continuing.", h)
                }
            }
        }
    }

    function S(e) {
        e = e || window;
        w();
        for (var t = 0, n = E.length; t < n; ++t) {
            E[t](e)
        }
    }

    function x(e) {
        this.name = e;
        this.initialized = false;
        this.supported = false
    }

    var e = "object", t = "function", n = "undefined";
    var r = ["startContainer", "startOffset", "endContainer", "endOffset", "collapsed", "commonAncestorContainer", "START_TO_START", "START_TO_END", "END_TO_START", "END_TO_END"];
    var i = ["setStart", "setStartBefore", "setStartAfter", "setEnd", "setEndBefore", "setEndAfter", "collapse", "selectNode", "selectNodeContents", "compareBoundaryPoints", "deleteContents", "extractContents", "cloneContents", "insertNode", "surroundContents", "cloneRange", "toString", "detach"];
    var s = ["boundingHeight", "boundingLeft", "boundingTop", "boundingWidth", "htmlText", "text"];
    var o = ["collapse", "compareEndPoints", "duplicate", "getBookmark", "moveToBookmark", "moveToElementText", "parentElement", "pasteHTML", "select", "setEndPoint", "getBoundingClientRect"];
    var c = l(u);
    var h = l(a);
    var p = l(f);
    var v = {version: "1.2.2", initialized: false, supported: true, util: {isHostMethod: u, isHostObject: a, isHostProperty: f, areHostMethods: c, areHostObjects: h, areHostProperties: p, isTextRange: d}, features: {}, modules: {}, config: {alertOnWarn: false, preferTextRange: false}};
    v.fail = m;
    v.warn = g;
    if ({}.hasOwnProperty) {
        v.util.extend = function (e, t) {
            for (var n in t) {
                if (t.hasOwnProperty(n)) {
                    e[n] = t[n]
                }
            }
        }
    } else {
        m("hasOwnProperty not supported")
    }
    var y = [];
    var b = [];
    v.init = w;
    v.addInitListener = function (e) {
        if (v.initialized) {
            e(v)
        } else {
            y.push(e)
        }
    };
    var E = [];
    v.addCreateMissingNativeApiListener = function (e) {
        E.push(e)
    };
    v.createMissingNativeApi = S;
    x.prototype.fail = function (e) {
        this.initialized = true;
        this.supported = false;
        throw new Error("Module '" + this.name + "' failed to load: " + e)
    };
    x.prototype.warn = function (e) {
        v.warn("Module " + this.name + ": " + e)
    };
    x.prototype.createError = function (e) {
        return new Error("Error in Rangy " + this.name + " module: " + e)
    };
    v.createModule = function (e, t) {
        var n = new x(e);
        v.modules[e] = n;
        b.push(function (e) {
            t(e, n);
            n.initialized = true;
            n.supported = true
        })
    };
    v.requireModules = function (e) {
        for (var t = 0, n = e.length, r, i; t < n; ++t) {
            i = e[t];
            r = v.modules[i];
            if (!r || !(r instanceof x)) {
                throw new Error("Module '" + i + "' not found")
            }
            if (!r.supported) {
                throw new Error("Module '" + i + "' not supported")
            }
        }
    };
    var T = false;
    var N = function (e) {
        if (!T) {
            T = true;
            if (!v.initialized) {
                w()
            }
        }
    };
    if (typeof window == n) {
        m("No window found");
        return
    }
    if (typeof document == n) {
        m("No document found");
        return
    }
    if (u(document, "addEventListener")) {
        document.addEventListener("DOMContentLoaded", N, false)
    }
    if (u(window, "addEventListener")) {
        window.addEventListener("load", N, false)
    } else if (u(window, "attachEvent")) {
        window.attachEvent("onload", N)
    } else {
        m("Window does not have required addEventListener or attachEvent method")
    }
    return v
}();
rangy.createModule("DomUtil", function (e, t) {
    function u(e) {
        var t;
        return typeof e.namespaceURI == n || (t = e.namespaceURI) === null || t == "http://www.w3.org/1999/xhtml"
    }

    function a(e) {
        var t = e.parentNode;
        return t.nodeType == 1 ? t : null
    }

    function f(e) {
        var t = 0;
        while (e = e.previousSibling) {
            t++
        }
        return t
    }

    function l(e) {
        var t;
        return d(e) ? e.length : (t = e.childNodes) ? t.length : 0
    }

    function c(e, t) {
        var n = [], r;
        for (r = e; r; r = r.parentNode) {
            n.push(r)
        }
        for (r = t; r; r = r.parentNode) {
            if (o(n, r)) {
                return r
            }
        }
        return null
    }

    function h(e, t, n) {
        var r = n ? t : t.parentNode;
        while (r) {
            if (r === e) {
                return true
            } else {
                r = r.parentNode
            }
        }
        return false
    }

    function p(e, t, n) {
        var r, i = n ? e : e.parentNode;
        while (i) {
            r = i.parentNode;
            if (r === t) {
                return i
            }
            i = r
        }
        return null
    }

    function d(e) {
        var t = e.nodeType;
        return t == 3 || t == 4 || t == 8
    }

    function v(e, t) {
        var n = t.nextSibling, r = t.parentNode;
        if (n) {
            r.insertBefore(e, n)
        } else {
            r.appendChild(e)
        }
        return e
    }

    function m(e, t) {
        var n = e.cloneNode(false);
        n.deleteData(0, t);
        e.deleteData(t, e.length - t);
        v(n, e);
        return n
    }

    function g(e) {
        if (e.nodeType == 9) {
            return e
        } else if (typeof e.ownerDocument != n) {
            return e.ownerDocument
        } else if (typeof e.document != n) {
            return e.document
        } else if (e.parentNode) {
            return g(e.parentNode)
        } else {
            throw new Error("getDocument: no document found for node")
        }
    }

    function y(e) {
        var t = g(e);
        if (typeof t.defaultView != n) {
            return t.defaultView
        } else if (typeof t.parentWindow != n) {
            return t.parentWindow
        } else {
            throw new Error("Cannot get a window object for node")
        }
    }

    function b(e) {
        if (typeof e.contentDocument != n) {
            return e.contentDocument
        } else if (typeof e.contentWindow != n) {
            return e.contentWindow.document
        } else {
            throw new Error("getIframeWindow: No Document object found for iframe element")
        }
    }

    function w(e) {
        if (typeof e.contentWindow != n) {
            return e.contentWindow
        } else if (typeof e.contentDocument != n) {
            return e.contentDocument.defaultView
        } else {
            throw new Error("getIframeWindow: No Window object found for iframe element")
        }
    }

    function E(e) {
        return r.isHostObject(e, "body") ? e.body : e.getElementsByTagName("body")[0]
    }

    function S(e) {
        var t;
        while (t = e.parentNode) {
            e = t
        }
        return e
    }

    function x(e, t, n, r) {
        var i, s, o, u, a;
        if (e == n) {
            return t === r ? 0 : t < r ? -1 : 1
        } else if (i = p(n, e, true)) {
            return t <= f(i) ? -1 : 1
        } else if (i = p(e, n, true)) {
            return f(i) < r ? -1 : 1
        } else {
            s = c(e, n);
            o = e === s ? s : p(e, s, true);
            u = n === s ? s : p(n, s, true);
            if (o === u) {
                throw new Error("comparePoints got to case 4 and childA and childB are the same!")
            } else {
                a = s.firstChild;
                while (a) {
                    if (a === o) {
                        return-1
                    } else if (a === u) {
                        return 1
                    }
                    a = a.nextSibling
                }
                throw new Error("Should not be here!")
            }
        }
    }

    function T(e) {
        var t = g(e).createDocumentFragment(), n;
        while (n = e.firstChild) {
            t.appendChild(n)
        }
        return t
    }

    function N(e) {
        if (!e) {
            return"[No node]"
        }
        if (d(e)) {
            return'"' + e.data + '"'
        } else if (e.nodeType == 1) {
            var t = e.id ? ' id="' + e.id + '"' : "";
            return"<" + e.nodeName + t + ">[" + e.childNodes.length + "]"
        } else {
            return e.nodeName
        }
    }

    function C(e) {
        this.root = e;
        this._next = e
    }

    function k(e) {
        return new C(e)
    }

    function L(e, t) {
        this.node = e;
        this.offset = t
    }

    function A(e) {
        this.code = this[e];
        this.codeName = e;
        this.message = "DOMException: " + this.codeName
    }

    var n = "undefined";
    var r = e.util;
    if (!r.areHostMethods(document, ["createDocumentFragment", "createElement", "createTextNode"])) {
        t.fail("document missing a Node creation method")
    }
    if (!r.isHostMethod(document, "getElementsByTagName")) {
        t.fail("document missing getElementsByTagName method")
    }
    var i = document.createElement("div");
    if (!r.areHostMethods(i, ["insertBefore", "appendChild", "cloneNode"] || !r.areHostObjects(i, ["previousSibling", "nextSibling", "childNodes", "parentNode"]))) {
        t.fail("Incomplete Element implementation")
    }
    if (!r.isHostProperty(i, "innerHTML")) {
        t.fail("Element is missing innerHTML property")
    }
    var s = document.createTextNode("test");
    if (!r.areHostMethods(s, ["splitText", "deleteData", "insertData", "appendData", "cloneNode"] || !r.areHostObjects(i, ["previousSibling", "nextSibling", "childNodes", "parentNode"]) || !r.areHostProperties(s, ["data"]))) {
        t.fail("Incomplete Text Node implementation")
    }
    var o = function (e, t) {
        var n = e.length;
        while (n--) {
            if (e[n] === t) {
                return true
            }
        }
        return false
    };
    C.prototype = {_current: null, hasNext: function () {
        return!!this._next
    }, next: function () {
        var e = this._current = this._next;
        var t, n;
        if (this._current) {
            t = e.firstChild;
            if (t) {
                this._next = t
            } else {
                n = null;
                while (e !== this.root && !(n = e.nextSibling)) {
                    e = e.parentNode
                }
                this._next = n
            }
        }
        return this._current
    }, detach: function () {
        this._current = this._next = this.root = null
    }};
    L.prototype = {equals: function (e) {
        return this.node === e.node & this.offset == e.offset
    }, inspect: function () {
        return"[DomPosition(" + N(this.node) + ":" + this.offset + ")]"
    }};
    A.prototype = {INDEX_SIZE_ERR: 1, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INVALID_STATE_ERR: 11};
    A.prototype.toString = function () {
        return this.message
    };
    e.dom = {arrayContains: o, isHtmlNamespace: u, parentElement: a, getNodeIndex: f, getNodeLength: l, getCommonAncestor: c, isAncestorOf: h, getClosestAncestorIn: p, isCharacterDataNode: d, insertAfter: v, splitDataNode: m, getDocument: g, getWindow: y, getIframeWindow: w, getIframeDocument: b, getBody: E, getRootContainer: S, comparePoints: x, inspectNode: N, fragmentFromNodeChildren: T, createIterator: k, DomPosition: L};
    e.DOMException = A
});
rangy.createModule("DomRange", function (e, t) {
    function s(e, t) {
        return e.nodeType != 3 && (n.isAncestorOf(e, t.startContainer, true) || n.isAncestorOf(e, t.endContainer, true))
    }

    function o(e) {
        return n.getDocument(e.startContainer)
    }

    function u(e, t, n) {
        var r = e._listeners[t];
        if (r) {
            for (var i = 0, s = r.length; i < s; ++i) {
                r[i].call(e, {target: e, args: n})
            }
        }
    }

    function a(e) {
        return new r(e.parentNode, n.getNodeIndex(e))
    }

    function f(e) {
        return new r(e.parentNode, n.getNodeIndex(e) + 1)
    }

    function l(e, t, r) {
        var i = e.nodeType == 11 ? e.firstChild : e;
        if (n.isCharacterDataNode(t)) {
            if (r == t.length) {
                n.insertAfter(e, t)
            } else {
                t.parentNode.insertBefore(e, r == 0 ? t : n.splitDataNode(t, r))
            }
        } else if (r >= t.childNodes.length) {
            t.appendChild(e)
        } else {
            t.insertBefore(e, t.childNodes[r])
        }
        return i
    }

    function c(e) {
        var t;
        for (var n, r = o(e.range).createDocumentFragment(), s; n = e.next();) {
            t = e.isPartiallySelectedSubtree();
            n = n.cloneNode(!t);
            if (t) {
                s = e.getSubtreeIterator();
                n.appendChild(c(s));
                s.detach(true)
            }
            if (n.nodeType == 10) {
                throw new i("HIERARCHY_REQUEST_ERR")
            }
            r.appendChild(n)
        }
        return r
    }

    function h(e, t, r) {
        var i, s;
        r = r || {stop: false};
        for (var o, u; o = e.next();) {
            if (e.isPartiallySelectedSubtree()) {
                if (t(o) === false) {
                    r.stop = true;
                    return
                } else {
                    u = e.getSubtreeIterator();
                    h(u, t, r);
                    u.detach(true);
                    if (r.stop) {
                        return
                    }
                }
            } else {
                i = n.createIterator(o);
                while (s = i.next()) {
                    if (t(s) === false) {
                        r.stop = true;
                        return
                    }
                }
            }
        }
    }

    function p(e) {
        var t;
        while (e.next()) {
            if (e.isPartiallySelectedSubtree()) {
                t = e.getSubtreeIterator();
                p(t);
                t.detach(true)
            } else {
                e.remove()
            }
        }
    }

    function d(e) {
        for (var t, n = o(e.range).createDocumentFragment(), r; t = e.next();) {
            if (e.isPartiallySelectedSubtree()) {
                t = t.cloneNode(false);
                r = e.getSubtreeIterator();
                t.appendChild(d(r));
                r.detach(true)
            } else {
                e.remove()
            }
            if (t.nodeType == 10) {
                throw new i("HIERARCHY_REQUEST_ERR")
            }
            n.appendChild(t)
        }
        return n
    }

    function v(e, t, n) {
        var r = !!(t && t.length), i;
        var s = !!n;
        if (r) {
            i = new RegExp("^(" + t.join("|") + ")$")
        }
        var o = [];
        h(new g(e, false), function (e) {
            if ((!r || i.test(e.nodeType)) && (!s || n(e))) {
                o.push(e)
            }
        });
        return o
    }

    function m(e) {
        var t = typeof e.getName == "undefined" ? "Range" : e.getName();
        return"[" + t + "(" + n.inspectNode(e.startContainer) + ":" + e.startOffset + ", " + n.inspectNode(e.endContainer) + ":" + e.endOffset + ")]"
    }

    function g(e, t) {
        this.range = e;
        this.clonePartiallySelectedTextNodes = t;
        if (!e.collapsed) {
            this.sc = e.startContainer;
            this.so = e.startOffset;
            this.ec = e.endContainer;
            this.eo = e.endOffset;
            var r = e.commonAncestorContainer;
            if (this.sc === this.ec && n.isCharacterDataNode(this.sc)) {
                this.isSingleCharacterDataNode = true;
                this._first = this._last = this._next = this.sc
            } else {
                this._first = this._next = this.sc === r && !n.isCharacterDataNode(this.sc) ? this.sc.childNodes[this.so] : n.getClosestAncestorIn(this.sc, r, true);
                this._last = this.ec === r && !n.isCharacterDataNode(this.ec) ? this.ec.childNodes[this.eo - 1] : n.getClosestAncestorIn(this.ec, r, true)
            }
        }
    }

    function y(e) {
        this.code = this[e];
        this.codeName = e;
        this.message = "RangeException: " + this.codeName
    }

    function b(e, t, n) {
        this.nodes = v(e, t, n);
        this._next = this.nodes[0];
        this._position = 0
    }

    function N(e) {
        return function (t, r) {
            var i, s = r ? t : t.parentNode;
            while (s) {
                i = s.nodeType;
                if (n.arrayContains(e, i)) {
                    return s
                }
                s = s.parentNode
            }
            return null
        }
    }

    function O(e, t) {
        if (A(e, t)) {
            throw new y("INVALID_NODE_TYPE_ERR")
        }
    }

    function M(e) {
        if (!e.startContainer) {
            throw new i("INVALID_STATE_ERR")
        }
    }

    function _(e, t) {
        if (!n.arrayContains(t, e.nodeType)) {
            throw new y("INVALID_NODE_TYPE_ERR")
        }
    }

    function D(e, t) {
        if (t < 0 || t > (n.isCharacterDataNode(e) ? e.length : e.childNodes.length)) {
            throw new i("INDEX_SIZE_ERR")
        }
    }

    function P(e, t) {
        if (k(e, true) !== k(t, true)) {
            throw new i("WRONG_DOCUMENT_ERR")
        }
    }

    function H(e) {
        if (L(e, true)) {
            throw new i("NO_MODIFICATION_ALLOWED_ERR")
        }
    }

    function B(e, t) {
        if (!e) {
            throw new i(t)
        }
    }

    function j(e) {
        return!n.arrayContains(E, e.nodeType) && !k(e, true)
    }

    function F(e, t) {
        return t <= (n.isCharacterDataNode(e) ? e.length : e.childNodes.length)
    }

    function I(e) {
        M(e);
        if (j(e.startContainer) || j(e.endContainer) || !F(e.startContainer, e.startOffset) || !F(e.endContainer, e.endOffset)) {
            throw new Error("Range error: Range is no longer valid after DOM mutation (" + e.inspect() + ")")
        }
    }

    function Z() {
    }

    function et(e) {
        e.START_TO_START = X;
        e.START_TO_END = V;
        e.END_TO_END = $;
        e.END_TO_START = J;
        e.NODE_BEFORE = K;
        e.NODE_AFTER = Q;
        e.NODE_BEFORE_AND_AFTER = G;
        e.NODE_INSIDE = Y
    }

    function tt(e) {
        et(e);
        et(e.prototype)
    }

    function nt(e, t) {
        return function () {
            I(this);
            var r = this.startContainer, i = this.startOffset, s = this.commonAncestorContainer;
            var o = new g(this, true);
            var u, a;
            if (r !== s) {
                u = n.getClosestAncestorIn(r, s, true);
                a = f(u);
                r = a.node;
                i = a.offset
            }
            h(o, H);
            o.reset();
            var l = e(o);
            o.detach();
            t(this, r, i, r, i);
            return l
        }
    }

    function rt(t, r, i) {
        function o(e, t) {
            return function (n) {
                M(this);
                _(n, w);
                _(C(n), E);
                var r = (e ? a : f)(n);
                (t ? u : l)(this, r.node, r.offset)
            }
        }

        function u(e, t, i) {
            var s = e.endContainer, o = e.endOffset;
            if (t !== e.startContainer || i !== e.startOffset) {
                if (C(t) != C(s) || n.comparePoints(t, i, s, o) == 1) {
                    s = t;
                    o = i
                }
                r(e, t, i, s, o)
            }
        }

        function l(e, t, i) {
            var s = e.startContainer, o = e.startOffset;
            if (t !== e.endContainer || i !== e.endOffset) {
                if (C(t) != C(s) || n.comparePoints(t, i, s, o) == -1) {
                    s = t;
                    o = i
                }
                r(e, s, o, t, i)
            }
        }

        function c(e, t, n) {
            if (t !== e.startContainer || n !== e.startOffset || t !== e.endContainer || n !== e.endOffset) {
                r(e, t, n, t, n)
            }
        }

        t.prototype = new Z;
        e.util.extend(t.prototype, {setStart: function (e, t) {
            M(this);
            O(e, true);
            D(e, t);
            u(this, e, t)
        }, setEnd: function (e, t) {
            M(this);
            O(e, true);
            D(e, t);
            l(this, e, t)
        }, setStartBefore: o(true, true), setStartAfter: o(false, true), setEndBefore: o(true, false), setEndAfter: o(false, false), collapse: function (e) {
            I(this);
            if (e) {
                r(this, this.startContainer, this.startOffset, this.startContainer, this.startOffset)
            } else {
                r(this, this.endContainer, this.endOffset, this.endContainer, this.endOffset)
            }
        }, selectNodeContents: function (e) {
            M(this);
            O(e, true);
            r(this, e, 0, e, n.getNodeLength(e))
        }, selectNode: function (e) {
            M(this);
            O(e, false);
            _(e, w);
            var t = a(e), n = f(e);
            r(this, t.node, t.offset, n.node, n.offset)
        }, extractContents: nt(d, r), deleteContents: nt(p, r), canSurroundContents: function () {
            I(this);
            H(this.startContainer);
            H(this.endContainer);
            var e = new g(this, true);
            var t = e._first && s(e._first, this) || e._last && s(e._last, this);
            e.detach();
            return!t
        }, detach: function () {
            i(this)
        }, splitBoundaries: function () {
            I(this);
            var e = this.startContainer, t = this.startOffset, i = this.endContainer, s = this.endOffset;
            var o = e === i;
            if (n.isCharacterDataNode(i) && s > 0 && s < i.length) {
                n.splitDataNode(i, s)
            }
            if (n.isCharacterDataNode(e) && t > 0 && t < e.length) {
                e = n.splitDataNode(e, t);
                if (o) {
                    s -= t;
                    i = e
                } else if (i == e.parentNode && s >= n.getNodeIndex(e)) {
                    s++
                }
                t = 0
            }
            r(this, e, t, i, s)
        }, normalizeBoundaries: function () {
            I(this);
            var e = this.startContainer, t = this.startOffset, i = this.endContainer, s = this.endOffset;
            var o = function (e) {
                var t = e.nextSibling;
                if (t && t.nodeType == e.nodeType) {
                    i = e;
                    s = e.length;
                    e.appendData(t.data);
                    t.parentNode.removeChild(t)
                }
            };
            var u = function (r) {
                var o = r.previousSibling;
                if (o && o.nodeType == r.nodeType) {
                    e = r;
                    var u = r.length;
                    t = o.length;
                    r.insertData(0, o.data);
                    o.parentNode.removeChild(o);
                    if (e == i) {
                        s += t;
                        i = e
                    } else if (i == r.parentNode) {
                        var a = n.getNodeIndex(r);
                        if (s == a) {
                            i = r;
                            s = u
                        } else if (s > a) {
                            s--
                        }
                    }
                }
            };
            var a = true;
            if (n.isCharacterDataNode(i)) {
                if (i.length == s) {
                    o(i)
                }
            } else {
                if (s > 0) {
                    var f = i.childNodes[s - 1];
                    if (f && n.isCharacterDataNode(f)) {
                        o(f)
                    }
                }
                a = !this.collapsed
            }
            if (a) {
                if (n.isCharacterDataNode(e)) {
                    if (t == 0) {
                        u(e)
                    }
                } else {
                    if (t < e.childNodes.length) {
                        var l = e.childNodes[t];
                        if (l && n.isCharacterDataNode(l)) {
                            u(l)
                        }
                    }
                }
            } else {
                e = i;
                t = s
            }
            r(this, e, t, i, s)
        }, collapseToPoint: function (e, t) {
            M(this);
            O(e, true);
            D(e, t);
            c(this, e, t)
        }});
        tt(t)
    }

    function it(e) {
        e.collapsed = e.startContainer === e.endContainer && e.startOffset === e.endOffset;
        e.commonAncestorContainer = e.collapsed ? e.startContainer : n.getCommonAncestor(e.startContainer, e.endContainer)
    }

    function st(e, t, n, r, i) {
        var s = e.startContainer !== t || e.startOffset !== n;
        var o = e.endContainer !== r || e.endOffset !== i;
        e.startContainer = t;
        e.startOffset = n;
        e.endContainer = r;
        e.endOffset = i;
        it(e);
        u(e, "boundarychange", {startMoved: s, endMoved: o})
    }

    function ot(e) {
        M(e);
        e.startContainer = e.startOffset = e.endContainer = e.endOffset = null;
        e.collapsed = e.commonAncestorContainer = null;
        u(e, "detach", null);
        e._listeners = null
    }

    function ut(e) {
        this.startContainer = e;
        this.startOffset = 0;
        this.endContainer = e;
        this.endOffset = 0;
        this._listeners = {boundarychange: [], detach: []};
        it(this)
    }

    e.requireModules(["DomUtil"]);
    var n = e.dom;
    var r = n.DomPosition;
    var i = e.DOMException;
    g.prototype = {_current: null, _next: null, _first: null, _last: null, isSingleCharacterDataNode: false, reset: function () {
        this._current = null;
        this._next = this._first
    }, hasNext: function () {
        return!!this._next
    }, next: function () {
        var e = this._current = this._next;
        if (e) {
            this._next = e !== this._last ? e.nextSibling : null;
            if (n.isCharacterDataNode(e) && this.clonePartiallySelectedTextNodes) {
                if (e === this.ec) {
                    (e = e.cloneNode(true)).deleteData(this.eo, e.length - this.eo)
                }
                if (this._current === this.sc) {
                    (e = e.cloneNode(true)).deleteData(0, this.so)
                }
            }
        }
        return e
    }, remove: function () {
        var e = this._current, t, r;
        if (n.isCharacterDataNode(e) && (e === this.sc || e === this.ec)) {
            t = e === this.sc ? this.so : 0;
            r = e === this.ec ? this.eo : e.length;
            if (t != r) {
                e.deleteData(t, r - t)
            }
        } else {
            if (e.parentNode) {
                e.parentNode.removeChild(e)
            } else {
            }
        }
    }, isPartiallySelectedSubtree: function () {
        var e = this._current;
        return s(e, this.range)
    }, getSubtreeIterator: function () {
        var e;
        if (this.isSingleCharacterDataNode) {
            e = this.range.cloneRange();
            e.collapse()
        } else {
            e = new ut(o(this.range));
            var t = this._current;
            var r = t, i = 0, s = t, u = n.getNodeLength(t);
            if (n.isAncestorOf(t, this.sc, true)) {
                r = this.sc;
                i = this.so
            }
            if (n.isAncestorOf(t, this.ec, true)) {
                s = this.ec;
                u = this.eo
            }
            st(e, r, i, s, u)
        }
        return new g(e, this.clonePartiallySelectedTextNodes)
    }, detach: function (e) {
        if (e) {
            this.range.detach()
        }
        this.range = this._current = this._next = this._first = this._last = this.sc = this.so = this.ec = this.eo = null
    }};
    y.prototype = {BAD_BOUNDARYPOINTS_ERR: 1, INVALID_NODE_TYPE_ERR: 2};
    y.prototype.toString = function () {
        return this.message
    };
    b.prototype = {_current: null, hasNext: function () {
        return!!this._next
    }, next: function () {
        this._current = this._next;
        this._next = this.nodes[++this._position];
        return this._current
    }, detach: function () {
        this._current = this._next = this.nodes = null
    }};
    var w = [1, 3, 4, 5, 7, 8, 10];
    var E = [2, 9, 11];
    var S = [5, 6, 10, 12];
    var x = [1, 3, 4, 5, 7, 8, 10, 11];
    var T = [1, 3, 4, 5, 7, 8];
    var C = n.getRootContainer;
    var k = N([9, 11]);
    var L = N(S);
    var A = N([6, 10, 12]);
    var q = document.createElement("style");
    var R = false;
    try {
        q.innerHTML = "<b>x</b>";
        R = q.firstChild.nodeType == 3
    } catch (U) {
    }
    e.features.htmlParsingConforms = R;
    var z = R ? function (e) {
        var t = this.startContainer;
        var r = n.getDocument(t);
        if (!t) {
            throw new i("INVALID_STATE_ERR")
        }
        var s = null;
        if (t.nodeType == 1) {
            s = t
        } else if (n.isCharacterDataNode(t)) {
            s = n.parentElement(t)
        }
        if (s === null || s.nodeName == "HTML" && n.isHtmlNamespace(n.getDocument(s).documentElement) && n.isHtmlNamespace(s)) {
            s = r.createElement("body")
        } else {
            s = s.cloneNode(false)
        }
        s.innerHTML = e;
        return n.fragmentFromNodeChildren(s)
    } : function (e) {
        M(this);
        var t = o(this);
        var r = t.createElement("body");
        r.innerHTML = e;
        return n.fragmentFromNodeChildren(r)
    };
    var W = ["startContainer", "startOffset", "endContainer", "endOffset", "collapsed", "commonAncestorContainer"];
    var X = 0, V = 1, $ = 2, J = 3;
    var K = 0, Q = 1, G = 2, Y = 3;
    Z.prototype = {attachListener: function (e, t) {
        this._listeners[e].push(t)
    }, compareBoundaryPoints: function (e, t) {
        I(this);
        P(this.startContainer, t.startContainer);
        var r, i, s, o;
        var u = e == J || e == X ? "start" : "end";
        var a = e == V || e == X ? "start" : "end";
        r = this[u + "Container"];
        i = this[u + "Offset"];
        s = t[a + "Container"];
        o = t[a + "Offset"];
        return n.comparePoints(r, i, s, o)
    }, insertNode: function (e) {
        I(this);
        _(e, x);
        H(this.startContainer);
        if (n.isAncestorOf(e, this.startContainer, true)) {
            throw new i("HIERARCHY_REQUEST_ERR")
        }
        var t = l(e, this.startContainer, this.startOffset);
        this.setStartBefore(t)
    }, cloneContents: function () {
        I(this);
        var e, t;
        if (this.collapsed) {
            return o(this).createDocumentFragment()
        } else {
            if (this.startContainer === this.endContainer && n.isCharacterDataNode(this.startContainer)) {
                e = this.startContainer.cloneNode(true);
                e.data = e.data.slice(this.startOffset, this.endOffset);
                t = o(this).createDocumentFragment();
                t.appendChild(e);
                return t
            } else {
                var r = new g(this, true);
                e = c(r);
                r.detach()
            }
            return e
        }
    }, canSurroundContents: function () {
        I(this);
        H(this.startContainer);
        H(this.endContainer);
        var e = new g(this, true);
        var t = e._first && s(e._first, this) || e._last && s(e._last, this);
        e.detach();
        return!t
    }, surroundContents: function (e) {
        _(e, T);
        if (!this.canSurroundContents()) {
            throw new y("BAD_BOUNDARYPOINTS_ERR")
        }
        var t = this.extractContents();
        if (e.hasChildNodes()) {
            while (e.lastChild) {
                e.removeChild(e.lastChild)
            }
        }
        l(e, this.startContainer, this.startOffset);
        e.appendChild(t);
        this.selectNode(e)
    }, cloneRange: function () {
        I(this);
        var e = new ut(o(this));
        var t = W.length, n;
        while (t--) {
            n = W[t];
            e[n] = this[n]
        }
        return e
    }, toString: function () {
        I(this);
        var e = this.startContainer;
        if (e === this.endContainer && n.isCharacterDataNode(e)) {
            return e.nodeType == 3 || e.nodeType == 4 ? e.data.slice(this.startOffset, this.endOffset) : ""
        } else {
            var t = [], r = new g(this, true);
            h(r, function (e) {
                if (e.nodeType == 3 || e.nodeType == 4) {
                    t.push(e.data)
                }
            });
            r.detach();
            return t.join("")
        }
    }, compareNode: function (e) {
        I(this);
        var t = e.parentNode;
        var r = n.getNodeIndex(e);
        if (!t) {
            throw new i("NOT_FOUND_ERR")
        }
        var s = this.comparePoint(t, r), o = this.comparePoint(t, r + 1);
        if (s < 0) {
            return o > 0 ? G : K
        } else {
            return o > 0 ? Q : Y
        }
    }, comparePoint: function (e, t) {
        I(this);
        B(e, "HIERARCHY_REQUEST_ERR");
        P(e, this.startContainer);
        if (n.comparePoints(e, t, this.startContainer, this.startOffset) < 0) {
            return-1
        } else if (n.comparePoints(e, t, this.endContainer, this.endOffset) > 0) {
            return 1
        }
        return 0
    }, createContextualFragment: z, toHtml: function () {
        I(this);
        var e = o(this).createElement("div");
        e.appendChild(this.cloneContents());
        return e.innerHTML
    }, intersectsNode: function (e, t) {
        I(this);
        B(e, "NOT_FOUND_ERR");
        if (n.getDocument(e) !== o(this)) {
            return false
        }
        var r = e.parentNode, i = n.getNodeIndex(e);
        B(r, "NOT_FOUND_ERR");
        var s = n.comparePoints(r, i, this.endContainer, this.endOffset), u = n.comparePoints(r, i + 1, this.startContainer, this.startOffset);
        return t ? s <= 0 && u >= 0 : s < 0 && u > 0
    }, isPointInRange: function (e, t) {
        I(this);
        B(e, "HIERARCHY_REQUEST_ERR");
        P(e, this.startContainer);
        return n.comparePoints(e, t, this.startContainer, this.startOffset) >= 0 && n.comparePoints(e, t, this.endContainer, this.endOffset) <= 0
    }, intersectsRange: function (e, t) {
        I(this);
        if (o(e) != o(this)) {
            throw new i("WRONG_DOCUMENT_ERR")
        }
        var r = n.comparePoints(this.startContainer, this.startOffset, e.endContainer, e.endOffset), s = n.comparePoints(this.endContainer, this.endOffset, e.startContainer, e.startOffset);
        return t ? r <= 0 && s >= 0 : r < 0 && s > 0
    }, intersection: function (e) {
        if (this.intersectsRange(e)) {
            var t = n.comparePoints(this.startContainer, this.startOffset, e.startContainer, e.startOffset), r = n.comparePoints(this.endContainer, this.endOffset, e.endContainer, e.endOffset);
            var i = this.cloneRange();
            if (t == -1) {
                i.setStart(e.startContainer, e.startOffset)
            }
            if (r == 1) {
                i.setEnd(e.endContainer, e.endOffset)
            }
            return i
        }
        return null
    }, union: function (e) {
        if (this.intersectsRange(e, true)) {
            var t = this.cloneRange();
            if (n.comparePoints(e.startContainer, e.startOffset, this.startContainer, this.startOffset) == -1) {
                t.setStart(e.startContainer, e.startOffset)
            }
            if (n.comparePoints(e.endContainer, e.endOffset, this.endContainer, this.endOffset) == 1) {
                t.setEnd(e.endContainer, e.endOffset)
            }
            return t
        } else {
            throw new y("Ranges do not intersect")
        }
    }, containsNode: function (e, t) {
        if (t) {
            return this.intersectsNode(e, false)
        } else {
            return this.compareNode(e) == Y
        }
    }, containsNodeContents: function (e) {
        return this.comparePoint(e, 0) >= 0 && this.comparePoint(e, n.getNodeLength(e)) <= 0
    }, containsRange: function (e) {
        return this.intersection(e).equals(e)
    }, containsNodeText: function (e) {
        var t = this.cloneRange();
        t.selectNode(e);
        var n = t.getNodes([3]);
        if (n.length > 0) {
            t.setStart(n[0], 0);
            var r = n.pop();
            t.setEnd(r, r.length);
            var i = this.containsRange(t);
            t.detach();
            return i
        } else {
            return this.containsNodeContents(e)
        }
    }, createNodeIterator: function (e, t) {
        I(this);
        return new b(this, e, t)
    }, getNodes: function (e, t) {
        I(this);
        return v(this, e, t)
    }, getDocument: function () {
        return o(this)
    }, collapseBefore: function (e) {
        M(this);
        this.setEndBefore(e);
        this.collapse(false)
    }, collapseAfter: function (e) {
        M(this);
        this.setStartAfter(e);
        this.collapse(true)
    }, getName: function () {
        return"DomRange"
    }, equals: function (e) {
        return ut.rangesEqual(this, e)
    }, inspect: function () {
        return m(this)
    }};
    rt(ut, st, ot);
    e.rangePrototype = Z.prototype;
    ut.rangeProperties = W;
    ut.RangeIterator = g;
    ut.copyComparisonConstants = tt;
    ut.createPrototypeRange = rt;
    ut.inspect = m;
    ut.getRangeDocument = o;
    ut.rangesEqual = function (e, t) {
        return e.startContainer === t.startContainer && e.startOffset === t.startOffset && e.endContainer === t.endContainer && e.endOffset === t.endOffset
    };
    e.DomRange = ut;
    e.RangeException = y
});
rangy.createModule("WrappedRange", function (e, t) {
    function o(e) {
        var t = e.parentElement();
        var n = e.duplicate();
        n.collapse(true);
        var i = n.parentElement();
        n = e.duplicate();
        n.collapse(false);
        var s = n.parentElement();
        var o = i == s ? i : r.getCommonAncestor(i, s);
        return o == t ? o : r.getCommonAncestor(t, o)
    }

    function u(e) {
        return e.compareEndPoints("StartToEnd", e) == 0
    }

    function a(e, t, n, s) {
        var o = e.duplicate();
        o.collapse(n);
        var u = o.parentElement();
        if (!r.isAncestorOf(t, u, true)) {
            u = t
        }
        if (!u.canHaveHTML) {
            return new i(u.parentNode, r.getNodeIndex(u))
        }
        var a = r.getDocument(u).createElement("span");
        var f, l = n ? "StartToStart" : "StartToEnd";
        var c, h, p, d;
        do {
            u.insertBefore(a, a.previousSibling);
            o.moveToElementText(a)
        } while ((f = o.compareEndPoints(l, e)) > 0 && a.previousSibling);
        d = a.nextSibling;
        if (f == -1 && d && r.isCharacterDataNode(d)) {
            o.setEndPoint(n ? "EndToStart" : "EndToEnd", e);
            var v;
            if (/[\r\n]/.test(d.data)) {
                var m = o.duplicate();
                var g = m.text.replace(/\r\n/g, "\r").length;
                v = m.moveStart("character", g);
                while ((f = m.compareEndPoints("StartToEnd", m)) == -1) {
                    v++;
                    m.moveStart("character", 1)
                }
            } else {
                v = o.text.length
            }
            p = new i(d, v)
        } else {
            c = (s || !n) && a.previousSibling;
            h = (s || n) && a.nextSibling;
            if (h && r.isCharacterDataNode(h)) {
                p = new i(h, 0)
            } else if (c && r.isCharacterDataNode(c)) {
                p = new i(c, c.length)
            } else {
                p = new i(u, r.getNodeIndex(a))
            }
        }
        a.parentNode.removeChild(a);
        return p
    }

    function f(e, t) {
        var n, i, s = e.offset;
        var o = r.getDocument(e.node);
        var u, a, f = o.body.createTextRange();
        var l = r.isCharacterDataNode(e.node);
        if (l) {
            n = e.node;
            i = n.parentNode
        } else {
            a = e.node.childNodes;
            n = s < a.length ? a[s] : null;
            i = e.node
        }
        u = o.createElement("span");
        u.innerHTML = "&#feff;";
        if (n) {
            i.insertBefore(u, n)
        } else {
            i.appendChild(u)
        }
        f.moveToElementText(u);
        f.collapse(!t);
        i.removeChild(u);
        if (l) {
            f[t ? "moveStart" : "moveEnd"]("character", s)
        }
        return f
    }

    e.requireModules(["DomUtil", "DomRange"]);
    var n;
    var r = e.dom;
    var i = r.DomPosition;
    var s = e.DomRange;
    if (e.features.implementsDomRange && (!e.features.implementsTextRange || !e.config.preferTextRange)) {
        (function () {
            function u(e) {
                var t = i.length, n;
                while (t--) {
                    n = i[t];
                    e[n] = e.nativeRange[n]
                }
            }

            function a(e, t, n, r, i) {
                var s = e.startContainer !== t || e.startOffset != n;
                var o = e.endContainer !== r || e.endOffset != i;
                if (s || o) {
                    e.setEnd(r, i);
                    e.setStart(t, n)
                }
            }

            function f(e) {
                e.nativeRange.detach();
                e.detached = true;
                var t = i.length, n;
                while (t--) {
                    n = i[t];
                    e[n] = null
                }
            }

            var t;
            var i = s.rangeProperties;
            var o;
            var l;
            n = function (e) {
                if (!e) {
                    throw new Error("Range must be specified")
                }
                this.nativeRange = e;
                u(this)
            };
            s.createPrototypeRange(n, a, f);
            t = n.prototype;
            t.selectNode = function (e) {
                this.nativeRange.selectNode(e);
                u(this)
            };
            t.deleteContents = function () {
                this.nativeRange.deleteContents();
                u(this)
            };
            t.extractContents = function () {
                var e = this.nativeRange.extractContents();
                u(this);
                return e
            };
            t.cloneContents = function () {
                return this.nativeRange.cloneContents()
            };
            t.surroundContents = function (e) {
                this.nativeRange.surroundContents(e);
                u(this)
            };
            t.collapse = function (e) {
                this.nativeRange.collapse(e);
                u(this)
            };
            t.cloneRange = function () {
                return new n(this.nativeRange.cloneRange())
            };
            t.refresh = function () {
                u(this)
            };
            t.toString = function () {
                return this.nativeRange.toString()
            };
            var c = document.createTextNode("test");
            r.getBody(document).appendChild(c);
            var h = document.createRange();
            h.setStart(c, 0);
            h.setEnd(c, 0);
            try {
                h.setStart(c, 1);
                o = true;
                t.setStart = function (e, t) {
                    this.nativeRange.setStart(e, t);
                    u(this)
                };
                t.setEnd = function (e, t) {
                    this.nativeRange.setEnd(e, t);
                    u(this)
                };
                l = function (e) {
                    return function (t) {
                        this.nativeRange[e](t);
                        u(this)
                    }
                }
            } catch (p) {
                o = false;
                t.setStart = function (e, t) {
                    try {
                        this.nativeRange.setStart(e, t)
                    } catch (n) {
                        this.nativeRange.setEnd(e, t);
                        this.nativeRange.setStart(e, t)
                    }
                    u(this)
                };
                t.setEnd = function (e, t) {
                    try {
                        this.nativeRange.setEnd(e, t)
                    } catch (n) {
                        this.nativeRange.setStart(e, t);
                        this.nativeRange.setEnd(e, t)
                    }
                    u(this)
                };
                l = function (e, t) {
                    return function (n) {
                        try {
                            this.nativeRange[e](n)
                        } catch (r) {
                            this.nativeRange[t](n);
                            this.nativeRange[e](n)
                        }
                        u(this)
                    }
                }
            }
            t.setStartBefore = l("setStartBefore", "setEndBefore");
            t.setStartAfter = l("setStartAfter", "setEndAfter");
            t.setEndBefore = l("setEndBefore", "setStartBefore");
            t.setEndAfter = l("setEndAfter", "setStartAfter");
            h.selectNodeContents(c);
            if (h.startContainer == c && h.endContainer == c && h.startOffset == 0 && h.endOffset == c.length) {
                t.selectNodeContents = function (e) {
                    this.nativeRange.selectNodeContents(e);
                    u(this)
                }
            } else {
                t.selectNodeContents = function (e) {
                    this.setStart(e, 0);
                    this.setEnd(e, s.getEndOffset(e))
                }
            }
            h.selectNodeContents(c);
            h.setEnd(c, 3);
            var d = document.createRange();
            d.selectNodeContents(c);
            d.setEnd(c, 4);
            d.setStart(c, 2);
            if (h.compareBoundaryPoints(h.START_TO_END, d) == -1 & h.compareBoundaryPoints(h.END_TO_START, d) == 1) {
                t.compareBoundaryPoints = function (e, t) {
                    t = t.nativeRange || t;
                    if (e == t.START_TO_END) {
                        e = t.END_TO_START
                    } else if (e == t.END_TO_START) {
                        e = t.START_TO_END
                    }
                    return this.nativeRange.compareBoundaryPoints(e, t)
                }
            } else {
                t.compareBoundaryPoints = function (e, t) {
                    return this.nativeRange.compareBoundaryPoints(e, t.nativeRange || t)
                }
            }
            if (e.util.isHostMethod(h, "createContextualFragment")) {
                t.createContextualFragment = function (e) {
                    return this.nativeRange.createContextualFragment(e)
                }
            }
            r.getBody(document).removeChild(c);
            h.detach();
            d.detach()
        })();
        e.createNativeRange = function (e) {
            e = e || document;
            return e.createRange()
        }
    } else if (e.features.implementsTextRange) {
        n = function (e) {
            this.textRange = e;
            this.refresh()
        };
        n.prototype = new s(document);
        n.prototype.refresh = function () {
            var e, t;
            var n = o(this.textRange);
            if (u(this.textRange)) {
                t = e = a(this.textRange, n, true, true)
            } else {
                e = a(this.textRange, n, true, false);
                t = a(this.textRange, n, false, false)
            }
            this.setStart(e.node, e.offset);
            this.setEnd(t.node, t.offset)
        };
        s.copyComparisonConstants(n);
        var l = function () {
            return this
        }();
        if (typeof l.Range == "undefined") {
            l.Range = n
        }
        e.createNativeRange = function (e) {
            e = e || document;
            return e.body.createTextRange()
        }
    }
    if (e.features.implementsTextRange) {
        n.rangeToTextRange = function (e) {
            if (e.collapsed) {
                var t = f(new i(e.startContainer, e.startOffset), true);
                return t
            } else {
                var n = f(new i(e.startContainer, e.startOffset), true);
                var s = f(new i(e.endContainer, e.endOffset), false);
                var o = r.getDocument(e.startContainer).body.createTextRange();
                o.setEndPoint("StartToStart", n);
                o.setEndPoint("EndToEnd", s);
                return o
            }
        }
    }
    n.prototype.getName = function () {
        return"WrappedRange"
    };
    e.WrappedRange = n;
    e.createRange = function (t) {
        t = t || document;
        return new n(e.createNativeRange(t))
    };
    e.createRangyRange = function (e) {
        e = e || document;
        return new s(e)
    };
    e.createIframeRange = function (t) {
        return e.createRange(r.getIframeDocument(t))
    };
    e.createIframeRangyRange = function (t) {
        return e.createRangyRange(r.getIframeDocument(t))
    };
    e.addCreateMissingNativeApiListener(function (t) {
        var n = t.document;
        if (typeof n.createRange == "undefined") {
            n.createRange = function () {
                return e.createRange(this)
            }
        }
        n = t = null
    })
});
rangy.createModule("WrappedSelection", function (e, t) {
    function p(e) {
        return(e || window).getSelection()
    }

    function d(e) {
        return(e || window).document.selection
    }

    function L(e, t, n) {
        var r = n ? "end" : "start", i = n ? "start" : "end";
        e.anchorNode = t[r + "Container"];
        e.anchorOffset = t[r + "Offset"];
        e.focusNode = t[i + "Container"];
        e.focusOffset = t[i + "Offset"]
    }

    function A(e) {
        var t = e.nativeSelection;
        e.anchorNode = t.anchorNode;
        e.anchorOffset = t.anchorOffset;
        e.focusNode = t.focusNode;
        e.focusOffset = t.focusOffset
    }

    function O(e) {
        e.anchorNode = e.focusNode = null;
        e.anchorOffset = e.focusOffset = 0;
        e.rangeCount = 0;
        e.isCollapsed = true;
        e._ranges.length = 0
    }

    function M(t) {
        var n;
        if (t instanceof o) {
            n = t._selectionNativeRange;
            if (!n) {
                n = e.createNativeRange(i.getDocument(t.startContainer));
                n.setEnd(t.endContainer, t.endOffset);
                n.setStart(t.startContainer, t.startOffset);
                t._selectionNativeRange = n;
                t.attachListener("detach", function () {
                    this._selectionNativeRange = null
                })
            }
        } else if (t instanceof u) {
            n = t.nativeRange
        } else if (e.features.implementsDomRange && t instanceof i.getWindow(t.startContainer).Range) {
            n = t
        }
        return n
    }

    function _(e) {
        if (!e.length || e[0].nodeType != 1) {
            return false
        }
        for (var t = 1, n = e.length; t < n; ++t) {
            if (!i.isAncestorOf(e[0], e[t])) {
                return false
            }
        }
        return true
    }

    function D(e) {
        var t = e.getNodes();
        if (!_(t)) {
            throw new Error("getSingleElementFromRange: range " + e.inspect() + " did not consist of a single element")
        }
        return t[0]
    }

    function P(e) {
        return!!e && typeof e.text != "undefined"
    }

    function H(e, t) {
        var n = new u(t);
        e._ranges = [n];
        L(e, n, false);
        e.rangeCount = 1;
        e.isCollapsed = n.collapsed
    }

    function B(t) {
        t._ranges.length = 0;
        if (t.docSelection.type == "None") {
            O(t)
        } else {
            var n = t.docSelection.createRange();
            if (P(n)) {
                H(t, n)
            } else {
                t.rangeCount = n.length;
                var r, s = i.getDocument(n.item(0));
                for (var o = 0; o < t.rangeCount; ++o) {
                    r = e.createRange(s);
                    r.selectNode(n.item(o));
                    t._ranges.push(r)
                }
                t.isCollapsed = t.rangeCount == 1 && t._ranges[0].collapsed;
                L(t, t._ranges[t.rangeCount - 1], false)
            }
        }
    }

    function j(e, t) {
        var n = e.docSelection.createRange();
        var r = D(t);
        var s = i.getDocument(n.item(0));
        var o = i.getBody(s).createControlRange();
        for (var u = 0, a = n.length; u < a; ++u) {
            o.add(n.item(u))
        }
        try {
            o.add(r)
        } catch (f) {
            throw new Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")
        }
        o.select();
        B(e)
    }

    function I(e, t, n) {
        this.nativeSelection = e;
        this.docSelection = t;
        this._ranges = [];
        this.win = n;
        this.refresh()
    }

    function R(e, t) {
        var n = i.getDocument(t[0].startContainer);
        var r = i.getBody(n).createControlRange();
        for (var s = 0, o; s < rangeCount; ++s) {
            o = D(t[s]);
            try {
                r.add(o)
            } catch (u) {
                throw new Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)")
            }
        }
        r.select();
        B(e)
    }

    function V(e, t) {
        if (e.anchorNode && i.getDocument(e.anchorNode) !== i.getDocument(t)) {
            throw new a("WRONG_DOCUMENT_ERR")
        }
    }

    function $(e) {
        var t = [];
        var n = new f(e.anchorNode, e.anchorOffset);
        var r = new f(e.focusNode, e.focusOffset);
        var i = typeof e.getName == "function" ? e.getName() : "Selection";
        if (typeof e.rangeCount != "undefined") {
            for (var s = 0, u = e.rangeCount; s < u; ++s) {
                t[s] = o.inspect(e.getRangeAt(s))
            }
        }
        return"[" + i + "(Ranges: " + t.join(", ") + ")(anchor: " + n.inspect() + ", focus: " + r.inspect() + "]"
    }

    e.requireModules(["DomUtil", "DomRange", "WrappedRange"]);
    e.config.checkSelectionRanges = true;
    var n = "boolean", r = "_rangySelection", i = e.dom, s = e.util, o = e.DomRange, u = e.WrappedRange, a = e.DOMException, f = i.DomPosition, l, c, h = "Control";
    var v = e.util.isHostMethod(window, "getSelection"), m = e.util.isHostObject(document, "selection");
    var g = m && (!v || e.config.preferTextRange);
    if (g) {
        l = d;
        e.isSelectionValid = function (e) {
            var t = (e || window).document, n = t.selection;
            return n.type != "None" || i.getDocument(n.createRange().parentElement()) == t
        }
    } else if (v) {
        l = p;
        e.isSelectionValid = function () {
            return true
        }
    } else {
        t.fail("Neither document.selection or window.getSelection() detected.")
    }
    e.getNativeSelection = l;
    var y = l();
    var b = e.createNativeRange(document);
    var w = i.getBody(document);
    var E = s.areHostObjects(y, ["anchorNode", "focusNode"] && s.areHostProperties(y, ["anchorOffset", "focusOffset"]));
    e.features.selectionHasAnchorAndFocus = E;
    var S = s.isHostMethod(y, "extend");
    e.features.selectionHasExtend = S;
    var x = typeof y.rangeCount == "number";
    e.features.selectionHasRangeCount = x;
    var T = false;
    var N = true;
    if (s.areHostMethods(y, ["addRange", "getRangeAt", "removeAllRanges"]) && typeof y.rangeCount == "number" && e.features.implementsDomRange) {
        (function () {
            var e = document.createElement("iframe");
            w.appendChild(e);
            var t = i.getIframeDocument(e);
            t.open();
            t.write("<html><head></head><body>12</body></html>");
            t.close();
            var n = i.getIframeWindow(e).getSelection();
            var r = t.documentElement;
            var s = r.lastChild, o = s.firstChild;
            var u = t.createRange();
            u.setStart(o, 1);
            u.collapse(true);
            n.addRange(u);
            N = n.rangeCount == 1;
            n.removeAllRanges();
            var a = u.cloneRange();
            u.setStart(o, 0);
            a.setEnd(o, 2);
            n.addRange(u);
            n.addRange(a);
            T = n.rangeCount == 2;
            u.detach();
            a.detach();
            w.removeChild(e)
        })()
    }
    e.features.selectionSupportsMultipleRanges = T;
    e.features.collapsedNonEditableSelectionsSupported = N;
    var C = false, k;
    if (w && s.isHostMethod(w, "createControlRange")) {
        k = w.createControlRange();
        if (s.areHostProperties(k, ["item", "add"])) {
            C = true
        }
    }
    e.features.implementsControlRange = C;
    if (E) {
        c = function (e) {
            return e.anchorNode === e.focusNode && e.anchorOffset === e.focusOffset
        }
    } else {
        c = function (e) {
            return e.rangeCount ? e.getRangeAt(e.rangeCount - 1).collapsed : false
        }
    }
    var F;
    if (s.isHostMethod(y, "getRangeAt")) {
        F = function (e, t) {
            try {
                return e.getRangeAt(t)
            } catch (n) {
                return null
            }
        }
    } else if (E) {
        F = function (t) {
            var n = i.getDocument(t.anchorNode);
            var r = e.createRange(n);
            r.setStart(t.anchorNode, t.anchorOffset);
            r.setEnd(t.focusNode, t.focusOffset);
            if (r.collapsed !== this.isCollapsed) {
                r.setStart(t.focusNode, t.focusOffset);
                r.setEnd(t.anchorNode, t.anchorOffset)
            }
            return r
        }
    }
    e.getSelection = function (e) {
        e = e || window;
        var t = e[r];
        var n = l(e), i = m ? d(e) : null;
        if (t) {
            t.nativeSelection = n;
            t.docSelection = i;
            t.refresh(e)
        } else {
            t = new I(n, i, e);
            e[r] = t
        }
        return t
    };
    e.getIframeSelection = function (t) {
        return e.getSelection(i.getIframeWindow(t))
    };
    var q = I.prototype;
    if (!g && E && s.areHostMethods(y, ["removeAllRanges", "addRange"])) {
        q.removeAllRanges = function () {
            this.nativeSelection.removeAllRanges();
            O(this)
        };
        var U = function (t, n) {
            var r = o.getRangeDocument(n);
            var i = e.createRange(r);
            i.collapseToPoint(n.endContainer, n.endOffset);
            t.nativeSelection.addRange(M(i));
            t.nativeSelection.extend(n.startContainer, n.startOffset);
            t.refresh()
        };
        if (x) {
            q.addRange = function (t, n) {
                if (C && m && this.docSelection.type == h) {
                    j(this, t)
                } else {
                    if (n && S) {
                        U(this, t)
                    } else {
                        var r;
                        if (T) {
                            r = this.rangeCount
                        } else {
                            this.removeAllRanges();
                            r = 0
                        }
                        this.nativeSelection.addRange(M(t));
                        this.rangeCount = this.nativeSelection.rangeCount;
                        if (this.rangeCount == r + 1) {
                            if (e.config.checkSelectionRanges) {
                                var i = F(this.nativeSelection, this.rangeCount - 1);
                                if (i && !o.rangesEqual(i, t)) {
                                    t = new u(i)
                                }
                            }
                            this._ranges[this.rangeCount - 1] = t;
                            L(this, t, X(this.nativeSelection));
                            this.isCollapsed = c(this)
                        } else {
                            this.refresh()
                        }
                    }
                }
            }
        } else {
            q.addRange = function (e, t) {
                if (t && S) {
                    U(this, e)
                } else {
                    this.nativeSelection.addRange(M(e));
                    this.refresh()
                }
            }
        }
        q.setRanges = function (e) {
            if (C && e.length > 1) {
                R(this, e)
            } else {
                this.removeAllRanges();
                for (var t = 0, n = e.length; t < n; ++t) {
                    this.addRange(e[t])
                }
            }
        }
    } else if (s.isHostMethod(y, "empty") && s.isHostMethod(b, "select") && C && g) {
        q.removeAllRanges = function () {
            try {
                this.docSelection.empty();
                if (this.docSelection.type != "None") {
                    var e;
                    if (this.anchorNode) {
                        e = i.getDocument(this.anchorNode)
                    } else if (this.docSelection.type == h) {
                        var t = this.docSelection.createRange();
                        if (t.length) {
                            e = i.getDocument(t.item(0)).body.createTextRange()
                        }
                    }
                    if (e) {
                        var n = e.body.createTextRange();
                        n.select();
                        this.docSelection.empty()
                    }
                }
            } catch (r) {
            }
            O(this)
        };
        q.addRange = function (e) {
            if (this.docSelection.type == h) {
                j(this, e)
            } else {
                u.rangeToTextRange(e).select();
                this._ranges[0] = e;
                this.rangeCount = 1;
                this.isCollapsed = this._ranges[0].collapsed;
                L(this, e, false)
            }
        };
        q.setRanges = function (e) {
            this.removeAllRanges();
            var t = e.length;
            if (t > 1) {
                R(this, e)
            } else if (t) {
                this.addRange(e[0])
            }
        }
    } else {
        t.fail("No means of selecting a Range or TextRange was found");
        return false
    }
    q.getRangeAt = function (e) {
        if (e < 0 || e >= this.rangeCount) {
            throw new a("INDEX_SIZE_ERR")
        } else {
            return this._ranges[e]
        }
    };
    var z;
    if (g) {
        z = function (t) {
            var n;
            if (e.isSelectionValid(t.win)) {
                n = t.docSelection.createRange()
            } else {
                n = i.getBody(t.win.document).createTextRange();
                n.collapse(true)
            }
            if (t.docSelection.type == h) {
                B(t)
            } else if (P(n)) {
                H(t, n)
            } else {
                O(t)
            }
        }
    } else if (s.isHostMethod(y, "getRangeAt") && typeof y.rangeCount == "number") {
        z = function (t) {
            if (C && m && t.docSelection.type == h) {
                B(t)
            } else {
                t._ranges.length = t.rangeCount = t.nativeSelection.rangeCount;
                if (t.rangeCount) {
                    for (var n = 0, r = t.rangeCount; n < r; ++n) {
                        t._ranges[n] = new e.WrappedRange(t.nativeSelection.getRangeAt(n))
                    }
                    L(t, t._ranges[t.rangeCount - 1], X(t.nativeSelection));
                    t.isCollapsed = c(t)
                } else {
                    O(t)
                }
            }
        }
    } else if (E && typeof y.isCollapsed == n && typeof b.collapsed == n && e.features.implementsDomRange) {
        z = function (e) {
            var t, n = e.nativeSelection;
            if (n.anchorNode) {
                t = F(n, 0);
                e._ranges = [t];
                e.rangeCount = 1;
                A(e);
                e.isCollapsed = c(e)
            } else {
                O(e)
            }
        }
    } else {
        t.fail("No means of obtaining a Range or TextRange from the user's selection was found");
        return false
    }
    q.refresh = function (e) {
        var t = e ? this._ranges.slice(0) : null;
        z(this);
        if (e) {
            var n = t.length;
            if (n != this._ranges.length) {
                return false
            }
            while (n--) {
                if (!o.rangesEqual(t[n], this._ranges[n])) {
                    return false
                }
            }
            return true
        }
    };
    var W = function (e, t) {
        var n = e.getAllRanges(), r = false;
        e.removeAllRanges();
        for (var i = 0, s = n.length; i < s; ++i) {
            if (r || t !== n[i]) {
                e.addRange(n[i])
            } else {
                r = true
            }
        }
        if (!e.rangeCount) {
            O(e)
        }
    };
    if (C) {
        q.removeRange = function (e) {
            if (this.docSelection.type == h) {
                var t = this.docSelection.createRange();
                var n = D(e);
                var r = i.getDocument(t.item(0));
                var s = i.getBody(r).createControlRange();
                var o, u = false;
                for (var a = 0, f = t.length; a < f; ++a) {
                    o = t.item(a);
                    if (o !== n || u) {
                        s.add(t.item(a))
                    } else {
                        u = true
                    }
                }
                s.select();
                B(this)
            } else {
                W(this, e)
            }
        }
    } else {
        q.removeRange = function (e) {
            W(this, e)
        }
    }
    var X;
    if (!g && E && e.features.implementsDomRange) {
        X = function (e) {
            var t = false;
            if (e.anchorNode) {
                t = i.comparePoints(e.anchorNode, e.anchorOffset, e.focusNode, e.focusOffset) == 1
            }
            return t
        };
        q.isBackwards = function () {
            return X(this)
        }
    } else {
        X = q.isBackwards = function () {
            return false
        }
    }
    q.toString = function () {
        var e = [];
        for (var t = 0, n = this.rangeCount; t < n; ++t) {
            e[t] = "" + this._ranges[t]
        }
        return e.join("")
    };
    q.collapse = function (t, n) {
        V(this, t);
        var r = e.createRange(i.getDocument(t));
        r.collapseToPoint(t, n);
        this.removeAllRanges();
        this.addRange(r);
        this.isCollapsed = true
    };
    q.collapseToStart = function () {
        if (this.rangeCount) {
            var e = this._ranges[0];
            this.collapse(e.startContainer, e.startOffset)
        } else {
            throw new a("INVALID_STATE_ERR")
        }
    };
    q.collapseToEnd = function () {
        if (this.rangeCount) {
            var e = this._ranges[this.rangeCount - 1];
            this.collapse(e.endContainer, e.endOffset)
        } else {
            throw new a("INVALID_STATE_ERR")
        }
    };
    q.selectAllChildren = function (t) {
        V(this, t);
        var n = e.createRange(i.getDocument(t));
        n.selectNodeContents(t);
        this.removeAllRanges();
        this.addRange(n)
    };
    q.deleteFromDocument = function () {
        if (C && m && this.docSelection.type == h) {
            var e = this.docSelection.createRange();
            var t;
            while (e.length) {
                t = e.item(0);
                e.remove(t);
                t.parentNode.removeChild(t)
            }
            this.refresh()
        } else if (this.rangeCount) {
            var n = this.getAllRanges();
            this.removeAllRanges();
            for (var r = 0, i = n.length; r < i; ++r) {
                n[r].deleteContents()
            }
            this.addRange(n[i - 1])
        }
    };
    q.getAllRanges = function () {
        return this._ranges.slice(0)
    };
    q.setSingleRange = function (e) {
        this.setRanges([e])
    };
    q.containsNode = function (e, t) {
        for (var n = 0, r = this._ranges.length; n < r; ++n) {
            if (this._ranges[n].containsNode(e, t)) {
                return true
            }
        }
        return false
    };
    q.toHtml = function () {
        var e = "";
        if (this.rangeCount) {
            var t = o.getRangeDocument(this._ranges[0]).createElement("div");
            for (var n = 0, r = this._ranges.length; n < r; ++n) {
                t.appendChild(this._ranges[n].cloneContents())
            }
            e = t.innerHTML
        }
        return e
    };
    q.getName = function () {
        return"WrappedSelection"
    };
    q.inspect = function () {
        return $(this)
    };
    q.detach = function () {
        this.win[r] = null;
        this.win = this.anchorNode = this.focusNode = null
    };
    I.inspect = $;
    e.Selection = I;
    e.selectionPrototype = q;
    e.addCreateMissingNativeApiListener(function (t) {
        if (typeof t.getSelection == "undefined") {
            t.getSelection = function () {
                return e.getSelection(this)
            }
        }
        t = null
    })
});
var Base = function () {
};
Base.extend = function (e, t) {
    var n = Base.prototype.extend;
    Base._prototyping = true;
    var r = new this;
    n.call(r, e);
    r.base = function () {
    };
    delete Base._prototyping;
    var i = r.constructor;
    var s = r.constructor = function () {
        if (!Base._prototyping) {
            if (this._constructing || this.constructor == s) {
                this._constructing = true;
                i.apply(this, arguments);
                delete this._constructing
            } else if (arguments[0] != null) {
                return(arguments[0].extend || n).call(arguments[0], r)
            }
        }
    };
    s.ancestor = this;
    s.extend = this.extend;
    s.forEach = this.forEach;
    s.implement = this.implement;
    s.prototype = r;
    s.toString = this.toString;
    s.valueOf = function (e) {
        return e == "object" ? s : i.valueOf()
    };
    n.call(s, t);
    if (typeof s.init == "function")s.init();
    return s
};
Base.prototype = {extend: function (e, t) {
    if (arguments.length > 1) {
        var n = this[e];
        if (n && typeof t == "function" && (!n.valueOf || n.valueOf() != t.valueOf()) && /\bbase\b/.test(t)) {
            var r = t.valueOf();
            t = function () {
                var e = this.base || Base.prototype.base;
                this.base = n;
                var t = r.apply(this, arguments);
                this.base = e;
                return t
            };
            t.valueOf = function (e) {
                return e == "object" ? t : r
            };
            t.toString = Base.toString
        }
        this[e] = t
    } else if (e) {
        var i = Base.prototype.extend;
        if (!Base._prototyping && typeof this != "function") {
            i = this.extend || i
        }
        var s = {toSource: null};
        var o = ["constructor", "toString", "valueOf"];
        var u = Base._prototyping ? 0 : 1;
        while (a = o[u++]) {
            if (e[a] != s[a]) {
                i.call(this, a, e[a])
            }
        }
        for (var a in e) {
            if (!s[a])i.call(this, a, e[a])
        }
    }
    return this
}};
Base = Base.extend({constructor: function () {
    this.extend(arguments[0])
}}, {ancestor: Object, version: "1.1", forEach: function (e, t, n) {
    for (var r in e) {
        if (this.prototype[r] === undefined) {
            t.call(n, e[r], r, e)
        }
    }
}, implement: function () {
    for (var e = 0; e < arguments.length; e++) {
        if (typeof arguments[e] == "function") {
            arguments[e](this.prototype)
        } else {
            this.prototype.extend(arguments[e])
        }
    }
    return this
}, toString: function () {
    return String(this.valueOf())
}});
wysihtml5.browser = function () {
    function u(e) {
        return(/ipad|iphone|ipod/.test(e) && e.match(/ os (\d+).+? like mac os x/) || [, 0])[1]
    }

    var e = navigator.userAgent, t = document.createElement("div"), n = e.indexOf("MSIE") !== -1 && e.indexOf("Opera") === -1, r = e.indexOf("Gecko") !== -1 && e.indexOf("KHTML") === -1, i = e.indexOf("AppleWebKit/") !== -1, s = e.indexOf("Chrome/") !== -1, o = e.indexOf("Opera/") !== -1;
    return{USER_AGENT: e, supported: function () {
        var e = this.USER_AGENT.toLowerCase(), n = "contentEditable"in t, r = document.execCommand && document.queryCommandSupported && document.queryCommandState, i = document.querySelector && document.querySelectorAll, s = this.isIos() && u(e) < 5 || e.indexOf("opera mobi") !== -1 || e.indexOf("hpwos/") !== -1;
        return n && r && i && !s
    }, isTouchDevice: function () {
        return this.supportsEvent("touchmove")
    }, isIos: function () {
        var e = this.USER_AGENT.toLowerCase();
        return e.indexOf("webkit") !== -1 && e.indexOf("mobile") !== -1
    }, supportsSandboxedIframes: function () {
        return n
    }, throwsMixedContentWarningWhenIframeSrcIsEmpty: function () {
        return!("querySelector"in document)
    }, displaysCaretInEmptyContentEditableCorrectly: function () {
        return!r
    }, hasCurrentStyleProperty: function () {
        return"currentStyle"in t
    }, insertsLineBreaksOnReturn: function () {
        return r
    }, supportsPlaceholderAttributeOn: function (e) {
        return"placeholder"in e
    }, supportsEvent: function (e) {
        return"on" + e in t || function () {
            t.setAttribute("on" + e, "return;");
            return typeof t["on" + e] === "function"
        }()
    }, supportsEventsInIframeCorrectly: function () {
        return!o
    }, firesOnDropOnlyWhenOnDragOverIsCancelled: function () {
        return i || r
    }, supportsDataTransfer: function () {
        try {
            return i && (window.Clipboard || window.DataTransfer).prototype.getData
        } catch (e) {
            return false
        }
    }, supportsHTML5Tags: function (e) {
        var t = e.createElement("div"), n = "<article>foo</article>";
        t.innerHTML = n;
        return t.innerHTML.toLowerCase() === n
    }, supportsCommand: function () {
        var e = {formatBlock: n, insertUnorderedList: n || o || i, insertOrderedList: n || o || i};
        var t = {insertHTML: r};
        return function (n, r) {
            var i = e[r];
            if (!i) {
                try {
                    return n.queryCommandSupported(r)
                } catch (s) {
                }
                try {
                    return n.queryCommandEnabled(r)
                } catch (o) {
                    return!!t[r]
                }
            }
            return false
        }
    }(), doesAutoLinkingInContentEditable: function () {
        return n
    }, canDisableAutoLinking: function () {
        return this.supportsCommand(document, "AutoUrlDetect")
    }, clearsContentEditableCorrectly: function () {
        return r || o || i
    }, supportsGetAttributeCorrectly: function () {
        var e = document.createElement("td");
        return e.getAttribute("rowspan") != "1"
    }, canSelectImagesInContentEditable: function () {
        return r || n || o
    }, clearsListsInContentEditableCorrectly: function () {
        return r || n || i
    }, autoScrollsToCaret: function () {
        return!i
    }, autoClosesUnclosedTags: function () {
        var e = t.cloneNode(false), n, r;
        e.innerHTML = "<p><div></div>";
        r = e.innerHTML.toLowerCase();
        n = r === "<p></p><div></div>" || r === "<p><div></div></p>";
        this.autoClosesUnclosedTags = function () {
            return n
        };
        return n
    }, supportsNativeGetElementsByClassName: function () {
        return String(document.getElementsByClassName).indexOf("[native code]") !== -1
    }, supportsSelectionModify: function () {
        return"getSelection"in window && "modify"in window.getSelection()
    }, supportsClassList: function () {
        return"classList"in t
    }, needsSpaceAfterLineBreak: function () {
        return o
    }, supportsSpeechApiOn: function (t) {
        var n = e.match(/Chrome\/(\d+)/) || [, 0];
        return n[1] >= 11 && ("onwebkitspeechchange"in t || "speech"in t)
    }, crashesWhenDefineProperty: function (e) {
        return n && (e === "XMLHttpRequest" || e === "XDomainRequest")
    }, doesAsyncFocus: function () {
        return n
    }, hasProblemsSettingCaretAfterImg: function () {
        return n
    }, hasUndoInContextMenu: function () {
        return r || s || o
    }}
}();
wysihtml5.lang.array = function (e) {
    return{contains: function (t) {
        if (e.indexOf) {
            return e.indexOf(t) !== -1
        } else {
            for (var n = 0, r = e.length; n < r; n++) {
                if (e[n] === t) {
                    return true
                }
            }
            return false
        }
    }, without: function (t) {
        t = wysihtml5.lang.array(t);
        var n = [], r = 0, i = e.length;
        for (; r < i; r++) {
            if (!t.contains(e[r])) {
                n.push(e[r])
            }
        }
        return n
    }, get: function () {
        var t = 0, n = e.length, r = [];
        for (; t < n; t++) {
            r.push(e[t])
        }
        return r
    }}
};
wysihtml5.lang.Dispatcher = Base.extend({observe: function (e, t) {
    this.events = this.events || {};
    this.events[e] = this.events[e] || [];
    this.events[e].push(t);
    return this
}, on: function () {
    return this.observe.apply(this, wysihtml5.lang.array(arguments).get())
}, fire: function (e, t) {
    this.events = this.events || {};
    var n = this.events[e] || [], r = 0;
    for (; r < n.length; r++) {
        n[r].call(this, t)
    }
    return this
}, stopObserving: function (e, t) {
    this.events = this.events || {};
    var n = 0, r, i;
    if (e) {
        r = this.events[e] || [], i = [];
        for (; n < r.length; n++) {
            if (r[n] !== t && t) {
                i.push(r[n])
            }
        }
        this.events[e] = i
    } else {
        this.events = {}
    }
    return this
}});
wysihtml5.lang.object = function (e) {
    return{merge: function (t) {
        for (var n in t) {
            e[n] = t[n]
        }
        return this
    }, get: function () {
        return e
    }, clone: function () {
        var t = {}, n;
        for (n in e) {
            t[n] = e[n]
        }
        return t
    }, isArray: function () {
        return Object.prototype.toString.call(e) === "[object Array]"
    }}
};
(function () {
    var e = /^\s+/, t = /\s+$/;
    wysihtml5.lang.string = function (n) {
        n = String(n);
        return{trim: function () {
            return n.replace(e, "").replace(t, "")
        }, interpolate: function (e) {
            for (var t in e) {
                n = this.replace("#{"+t+"}").by(e[t])
            }
            return n
        }, replace: function (e) {
            return{by: function (t) {
                return n.split(e).join(t)
            }}
        }}
    }
})();
(function (e) {
    function o(e) {
        if (l(e)) {
            return e
        }
        if (e === e.ownerDocument.documentElement) {
            e = e.ownerDocument.body
        }
        return c(e)
    }

    function u(e) {
        return e.replace(n, function (e, t) {
            var n = (t.match(r) || [])[1] || "", o = s[n];
            t = t.replace(r, "");
            if (t.split(o).length > t.split(n).length) {
                t = t + n;
                n = ""
            }
            var u = t, a = t;
            if (t.length > i) {
                a = a.substr(0, i) + "..."
            }
            if (u.substr(0, 4) === "www.") {
                u = "http://" + u
            }
            return'<a href="' + u + '">' + a + "</a>" + n
        })
    }

    function a(e) {
        var t = e._wysihtml5_tempElement;
        if (!t) {
            t = e._wysihtml5_tempElement = e.createElement("div")
        }
        return t
    }

    function f(e) {
        var t = e.parentNode, n = a(t.ownerDocument);
        n.innerHTML = "<span></span>" + u(e.data);
        n.removeChild(n.firstChild);
        while (n.firstChild) {
            t.insertBefore(n.firstChild, e)
        }
        t.removeChild(e)
    }

    function l(e) {
        var n;
        while (e.parentNode) {
            e = e.parentNode;
            n = e.nodeName;
            if (t.contains(n)) {
                return true
            } else if (n === "body") {
                return false
            }
        }
        return false
    }

    function c(r) {
        if (t.contains(r.nodeName)) {
            return
        }
        if (r.nodeType === e.TEXT_NODE && r.data.match(n)) {
            f(r);
            return
        }
        var i = e.lang.array(r.childNodes).get(), s = i.length, o = 0;
        for (; o < s; o++) {
            c(i[o])
        }
        return r
    }

    var t = e.lang.array(["CODE", "PRE", "A", "SCRIPT", "HEAD", "TITLE", "STYLE"]), n = /((https?:\/\/|www\.)[^\s<]{3,})/gi, r = /([^\w\/\-](,?))$/i, i = 100, s = {")": "(", "]": "[", "}": "{"};
    e.dom.autoLink = o;
    e.dom.autoLink.URL_REG_EXP = n
})(wysihtml5);
(function (e) {
    var t = e.browser.supportsClassList(), n = e.dom;
    n.addClass = function (e, r) {
        if (t) {
            return e.classList.add(r)
        }
        if (n.hasClass(e, r)) {
            return
        }
        e.className += " " + r
    };
    n.removeClass = function (e, n) {
        if (t) {
            return e.classList.remove(n)
        }
        e.className = e.className.replace(new RegExp("(^|\\s+)" + n + "(\\s+|$)"), " ")
    };
    n.hasClass = function (e, n) {
        if (t) {
            return e.classList.contains(n)
        }
        var r = e.className;
        return r.length > 0 && (r == n || (new RegExp("(^|\\s)" + n + "(\\s|$)")).test(r))
    }
})(wysihtml5);
wysihtml5.dom.contains = function () {
    var e = document.documentElement;
    if (e.contains) {
        return function (e, t) {
            if (t.nodeType !== wysihtml5.ELEMENT_NODE) {
                t = t.parentNode
            }
            return e !== t && e.contains(t)
        }
    } else if (e.compareDocumentPosition) {
        return function (e, t) {
            return!!(e.compareDocumentPosition(t) & 16)
        }
    }
}();
wysihtml5.dom.convertToList = function () {
    function e(e, t) {
        var n = e.createElement("li");
        t.appendChild(n);
        return n
    }

    function t(e, t) {
        return e.createElement(t)
    }

    function n(n, r) {
        if (n.nodeName === "UL" || n.nodeName === "OL" || n.nodeName === "MENU") {
            return n
        }
        var i = n.ownerDocument, s = t(i, r), o = n.querySelectorAll("br"), u = o.length, a, f, l, c, h, p, d, v, m;
        for (m = 0; m < u; m++) {
            c = o[m];
            while ((h = c.parentNode) && h !== n && h.lastChild === c) {
                if (wysihtml5.dom.getStyle("display").from(h) === "block") {
                    h.removeChild(c);
                    break
                }
                wysihtml5.dom.insert(c).after(c.parentNode)
            }
        }
        a = wysihtml5.lang.array(n.childNodes).get();
        f = a.length;
        for (m = 0; m < f; m++) {
            v = v || e(i, s);
            l = a[m];
            p = wysihtml5.dom.getStyle("display").from(l) === "block";
            d = l.nodeName === "BR";
            if (p) {
                v = v.firstChild ? e(i, s) : v;
                v.appendChild(l);
                v = null;
                continue
            }
            if (d) {
                v = v.firstChild ? null : v;
                continue
            }
            v.appendChild(l)
        }
        n.parentNode.replaceChild(s, n);
        return s
    }

    return n
}();
wysihtml5.dom.copyAttributes = function (e) {
    return{from: function (t) {
        return{to: function (n) {
            var r, i = 0, s = e.length;
            for (; i < s; i++) {
                r = e[i];
                if (typeof t[r] !== "undefined" && t[r] !== "") {
                    n[r] = t[r]
                }
            }
            return{andTo: arguments.callee}
        }}
    }}
};
(function (e) {
    var t = ["-webkit-box-sizing", "-moz-box-sizing", "-ms-box-sizing", "box-sizing"];
    var n = function (t) {
        if (r(t)) {
            return parseInt(e.getStyle("width").from(t), 10) < t.offsetWidth
        }
        return false
    };
    var r = function (n) {
        var r = 0, i = t.length;
        for (; r < i; r++) {
            if (e.getStyle(t[r]).from(n) === "border-box") {
                return t[r]
            }
        }
    };
    e.copyStyles = function (r) {
        return{from: function (i) {
            if (n(i)) {
                r = wysihtml5.lang.array(r).without(t)
            }
            var s = "", o = r.length, u = 0, a;
            for (; u < o; u++) {
                a = r[u];
                s += a + ":" + e.getStyle(a).from(i) + ";"
            }
            return{to: function (t) {
                e.setStyles(s).on(t);
                return{andTo: arguments.callee}
            }}
        }}
    }
})(wysihtml5.dom);
(function (e) {
    e.dom.delegate = function (t, n, r, i) {
        return e.dom.observe(t, r, function (r) {
            var s = r.target, o = e.lang.array(t.querySelectorAll(n));
            while (s && s !== t) {
                if (o.contains(s)) {
                    i.call(s, r);
                    break
                }
                s = s.parentNode
            }
        })
    }
})(wysihtml5);
wysihtml5.dom.getAsDom = function () {
    var e = function (e, t) {
        var n = t.createElement("div");
        n.style.display = "none";
        t.body.appendChild(n);
        try {
            n.innerHTML = e
        } catch (r) {
        }
        t.body.removeChild(n);
        return n
    };
    var t = function (e) {
        if (e._wysihtml5_supportsHTML5Tags) {
            return
        }
        for (var t = 0, r = n.length; t < r; t++) {
            e.createElement(n[t])
        }
        e._wysihtml5_supportsHTML5Tags = true
    };
    var n = ["abbr", "article", "aside", "audio", "bdi", "canvas", "command", "datalist", "details", "figcaption", "figure", "footer", "header", "hgroup", "keygen", "mark", "meter", "nav", "output", "progress", "rp", "rt", "ruby", "svg", "section", "source", "summary", "time", "track", "video", "wbr"];
    return function (n, r) {
        r = r || document;
        var i;
        if (typeof n === "object" && n.nodeType) {
            i = r.createElement("div");
            i.appendChild(n)
        } else if (wysihtml5.browser.supportsHTML5Tags(r)) {
            i = r.createElement("div");
            i.innerHTML = n
        } else {
            t(r);
            i = e(n, r)
        }
        return i
    }
}();
wysihtml5.dom.getParentElement = function () {
    function e(e, t) {
        if (!t || !t.length) {
            return true
        }
        if (typeof t === "string") {
            return e === t
        } else {
            return wysihtml5.lang.array(t).contains(e)
        }
    }

    function t(e) {
        return e.nodeType === wysihtml5.ELEMENT_NODE
    }

    function n(e, t, n) {
        var r = (e.className || "").match(n) || [];
        if (!t) {
            return!!r.length
        }
        return r[r.length - 1] === t
    }

    function r(t, n, r) {
        while (r-- && t && t.nodeName !== "BODY") {
            if (e(t.nodeName, n)) {
                return t
            }
            t = t.parentNode
        }
        return null
    }

    function i(r, i, s, o, u) {
        while (u-- && r && r.nodeName !== "BODY") {
            if (t(r) && e(r.nodeName, i) && n(r, s, o)) {
                return r
            }
            r = r.parentNode
        }
        return null
    }

    return function (e, t, n) {
        n = n || 50;
        if (t.className || t.classRegExp) {
            return i(e, t.nodeName, t.className, t.classRegExp, n)
        } else {
            return r(e, t.nodeName, n)
        }
    }
}();
wysihtml5.dom.getStyle = function () {
    function n(e) {
        return e.replace(t, function (e) {
            return e.charAt(1).toUpperCase()
        })
    }

    var e = {"float": "styleFloat"in document.createElement("div").style ? "styleFloat" : "cssFloat"}, t = /\-[a-z]/g;
    return function (t) {
        return{from: function (r) {
            if (r.nodeType !== wysihtml5.ELEMENT_NODE) {
                return
            }
            var i = r.ownerDocument, s = e[t] || n(t), o = r.style, u = r.currentStyle, a = o[s];
            if (a) {
                return a
            }
            if (u) {
                try {
                    return u[s]
                } catch (f) {
                }
            }
            var l = i.defaultView || i.parentWindow, c = (t === "height" || t === "width") && r.nodeName === "TEXTAREA", h, p;
            if (l.getComputedStyle) {
                if (c) {
                    h = o.overflow;
                    o.overflow = "hidden"
                }
                p = l.getComputedStyle(r, null).getPropertyValue(t);
                if (c) {
                    o.overflow = h || ""
                }
                return p
            }
        }}
    }
}();
wysihtml5.dom.hasElementWithTagName = function () {
    function n(e) {
        return e._wysihtml5_identifier || (e._wysihtml5_identifier = t++)
    }

    var e = {}, t = 1;
    return function (t, r) {
        var i = n(t) + ":" + r, s = e[i];
        if (!s) {
            s = e[i] = t.getElementsByTagName(r)
        }
        return s.length > 0
    }
}();
(function (e) {
    function r(e) {
        return e._wysihtml5_identifier || (e._wysihtml5_identifier = n++)
    }

    var t = {}, n = 1;
    e.dom.hasElementWithClassName = function (n, i) {
        if (!e.browser.supportsNativeGetElementsByClassName()) {
            return!!n.querySelector("." + i)
        }
        var s = r(n) + ":" + i, o = t[s];
        if (!o) {
            o = t[s] = n.getElementsByClassName(i)
        }
        return o.length > 0
    }
})(wysihtml5);
wysihtml5.dom.insert = function (e) {
    return{after: function (t) {
        t.parentNode.insertBefore(e, t.nextSibling)
    }, before: function (t) {
        t.parentNode.insertBefore(e, t)
    }, into: function (t) {
        t.appendChild(e)
    }}
};
wysihtml5.dom.insertCSS = function (e) {
    e = e.join("\n");
    return{into: function (t) {
        var n = t.head || t.getElementsByTagName("head")[0], r = t.createElement("style");
        r.type = "text/css";
        if (r.styleSheet) {
            r.styleSheet.cssText = e
        } else {
            r.appendChild(t.createTextNode(e))
        }
        if (n) {
            n.appendChild(r)
        }
    }}
};
wysihtml5.dom.observe = function (e, t, n) {
    t = typeof t === "string" ? [t] : t;
    var r, i, s = 0, o = t.length;
    for (; s < o; s++) {
        i = t[s];
        if (e.addEventListener) {
            e.addEventListener(i, n, false)
        } else {
            r = function (t) {
                if (!("target"in t)) {
                    t.target = t.srcElement
                }
                t.preventDefault = t.preventDefault || function () {
                    this.returnValue = false
                };
                t.stopPropagation = t.stopPropagation || function () {
                    this.cancelBubble = true
                };
                n.call(e, t)
            };
            e.attachEvent("on" + i, r)
        }
    }
    return{stop: function () {
        var i, s = 0, o = t.length;
        for (; s < o; s++) {
            i = t[s];
            if (e.removeEventListener) {
                e.removeEventListener(i, n, false)
            } else {
                e.detachEvent("on" + i, r)
            }
        }
    }}
};
wysihtml5.dom.parse = function () {
    function s(e, t, n, s) {
        wysihtml5.lang.object(i).merge(r).merge(t).get();
        n = n || e.ownerDocument || document;
        var u = n.createDocumentFragment(), a = typeof e === "string", f, l, c;
        if (a) {
            f = wysihtml5.dom.getAsDom(e, n)
        } else {
            f = e
        }
        while (f.firstChild) {
            c = f.firstChild;
            f.removeChild(c);
            l = o(c, s);
            if (l) {
                u.appendChild(l)
            }
        }
        f.innerHTML = "";
        f.appendChild(u);
        return a ? wysihtml5.quirks.getCorrectInnerHTML(f) : f
    }

    function o(n, r) {
        var i = n.nodeType, s = n.childNodes, u = s.length, a, f = e[i], l = 0;
        a = f && f(n);
        if (!a) {
            return null
        }
        for (l = 0; l < u; l++) {
            newChild = o(s[l], r);
            if (newChild) {
                a.appendChild(newChild)
            }
        }
        if (r && a.childNodes.length <= 1 && a.nodeName.toLowerCase() === t && !a.attributes.length) {
            return a.firstChild
        }
        return a
    }

    function u(e) {
        var n, r, s, o = i.tags, u = e.nodeName.toLowerCase(), f = e.scopeName;
        if (e._wysihtml5) {
            return null
        }
        e._wysihtml5 = 1;
        if (e.className === "wysihtml5-temp") {
            return null
        }
        if (f && f != "HTML") {
            u = f + ":" + u
        }
        if ("outerHTML"in e) {
            if (!wysihtml5.browser.autoClosesUnclosedTags() && e.nodeName === "P" && e.outerHTML.slice(-4).toLowerCase() !== "</p>") {
                u = "div"
            }
        }
        if (u in o) {
            n = o[u];
            if (!n || n.remove) {
                return null
            }
            n = typeof n === "string" ? {rename_tag: n} : n
        } else if (e.firstChild) {
            n = {rename_tag: t}
        } else {
            return null
        }
        r = e.ownerDocument.createElement(n.rename_tag || u);
        a(e, r, n);
        e = null;
        return r
    }

    function a(e, t, r) {
        var s = {}, o = r.set_class, u = r.add_class, a = r.set_attributes, f = r.check_attributes, c = i.classes, h = 0, v = [], m = [], g = [], y = [], b, w, E, S, x, T, N;
        if (a) {
            s = wysihtml5.lang.object(a).clone()
        }
        if (f) {
            for (x in f) {
                N = p[f[x]];
                if (!N) {
                    continue
                }
                T = N(l(e, x));
                if (typeof T === "string") {
                    s[x] = T
                }
            }
        }
        if (o) {
            v.push(o)
        }
        if (u) {
            for (x in u) {
                N = d[u[x]];
                if (!N) {
                    continue
                }
                S = N(l(e, x));
                if (typeof S === "string") {
                    v.push(S)
                }
            }
        }
        c["_wysihtml5-temp-placeholder"] = 1;
        y = e.getAttribute("class");
        if (y) {
            v = v.concat(y.split(n))
        }
        b = v.length;
        for (; h < b; h++) {
            E = v[h];
            if (c[E]) {
                m.push(E)
            }
        }
        w = m.length;
        while (w--) {
            E = m[w];
            if (!wysihtml5.lang.array(g).contains(E)) {
                g.unshift(E)
            }
        }
        if (g.length) {
            s["class"] = g.join(" ")
        }
        for (x in s) {
            try {
                t.setAttribute(x, s[x])
            } catch (C) {
            }
        }
        if (s.src) {
            if (typeof s.width !== "undefined") {
                t.setAttribute("width", s.width)
            }
            if (typeof s.height !== "undefined") {
                t.setAttribute("height", s.height)
            }
        }
    }

    function l(e, t) {
        t = t.toLowerCase();
        var n = e.nodeName;
        if (n == "IMG" && t == "src" && c(e) === true) {
            return e.src
        } else if (f && "outerHTML"in e) {
            var r = e.outerHTML.toLowerCase(), i = r.indexOf(" " + t + "=") != -1;
            return i ? e.getAttribute(t) : null
        } else {
            return e.getAttribute(t)
        }
    }

    function c(e) {
        try {
            return e.complete && !e.mozMatchesSelector(":-moz-broken")
        } catch (t) {
            if (e.complete && e.readyState === "complete") {
                return true
            }
        }
    }

    function h(e) {
        return e.ownerDocument.createTextNode(e.data)
    }

    var e = {1: u, 3: h}, t = "span", n = /\s+/, r = {tags: {}, classes: {}}, i = {};
    var f = !wysihtml5.browser.supportsGetAttributeCorrectly();
    var p = {url: function () {
        var e = /^https?:\/\//i;
        return function (t) {
            if (!t || !t.match(e)) {
                return null
            }
            return t.replace(e, function (e) {
                return e.toLowerCase()
            })
        }
    }(), alt: function () {
        var e = /[^ a-z0-9_\-]/gi;
        return function (t) {
            if (!t) {
                return""
            }
            return t.replace(e, "")
        }
    }(), numbers: function () {
        var e = /\D/g;
        return function (t) {
            t = (t || "").replace(e, "");
            return t || null
        }
    }()};
    var d = {align_img: function () {
        var e = {left: "wysiwyg-float-left", right: "wysiwyg-float-right"};
        return function (t) {
            return e[String(t).toLowerCase()]
        }
    }(), align_text: function () {
        var e = {left: "wysiwyg-text-align-left", right: "wysiwyg-text-align-right", center: "wysiwyg-text-align-center", justify: "wysiwyg-text-align-justify"};
        return function (t) {
            return e[String(t).toLowerCase()]
        }
    }(), clear_br: function () {
        var e = {left: "wysiwyg-clear-left", right: "wysiwyg-clear-right", both: "wysiwyg-clear-both", all: "wysiwyg-clear-both"};
        return function (t) {
            return e[String(t).toLowerCase()]
        }
    }(), size_font: function () {
        var e = {1: "wysiwyg-font-size-xx-small", 2: "wysiwyg-font-size-small", 3: "wysiwyg-font-size-medium", 4: "wysiwyg-font-size-large", 5: "wysiwyg-font-size-x-large", 6: "wysiwyg-font-size-xx-large", 7: "wysiwyg-font-size-xx-large", "-": "wysiwyg-font-size-smaller", "+": "wysiwyg-font-size-larger"};
        return function (t) {
            return e[String(t).charAt(0)]
        }
    }()};
    return s
}();
wysihtml5.dom.removeEmptyTextNodes = function (e) {
    var t, n = wysihtml5.lang.array(e.childNodes).get(), r = n.length, i = 0;
    for (; i < r; i++) {
        t = n[i];
        if (t.nodeType === wysihtml5.TEXT_NODE && t.data === "") {
            t.parentNode.removeChild(t)
        }
    }
};
wysihtml5.dom.renameElement = function (e, t) {
    var n = e.ownerDocument.createElement(t), r;
    while (r = e.firstChild) {
        n.appendChild(r)
    }
    wysihtml5.dom.copyAttributes(["align", "className"]).from(e).to(n);
    e.parentNode.replaceChild(n, e);
    return n
};
wysihtml5.dom.replaceWithChildNodes = function (e) {
    if (!e.parentNode) {
        return
    }
    if (!e.firstChild) {
        e.parentNode.removeChild(e);
        return
    }
    var t = e.ownerDocument.createDocumentFragment();
    while (e.firstChild) {
        t.appendChild(e.firstChild)
    }
    e.parentNode.replaceChild(t, e);
    e = t = null
};
(function (e) {
    function t(t) {
        return e.getStyle("display").from(t) === "block"
    }

    function n(e) {
        return e.nodeName === "BR"
    }

    function r(e) {
        var t = e.ownerDocument.createElement("br");
        e.appendChild(t)
    }

    function i(e) {
        if (e.nodeName !== "MENU" && e.nodeName !== "UL" && e.nodeName !== "OL") {
            return
        }
        var i = e.ownerDocument, s = i.createDocumentFragment(), o = e.previousElementSibling || e.previousSibling, u, a, f, l, c;
        if (o && !t(o)) {
            r(s)
        }
        while (c = e.firstChild) {
            a = c.lastChild;
            while (u = c.firstChild) {
                f = u === a;
                l = f && !t(u) && !n(u);
                s.appendChild(u);
                if (l) {
                    r(s)
                }
            }
            c.parentNode.removeChild(c)
        }
        e.parentNode.replaceChild(s, e)
    }

    e.resolveList = i
})(wysihtml5.dom);
(function (e) {
    var t = document, n = ["parent", "top", "opener", "frameElement", "frames", "localStorage", "globalStorage", "sessionStorage", "indexedDB"], r = ["open", "close", "openDialog", "showModalDialog", "alert", "confirm", "prompt", "openDatabase", "postMessage", "XMLHttpRequest", "XDomainRequest"], i = ["referrer", "write", "open", "close"];
    e.dom.Sandbox = Base.extend({constructor: function (t, n) {
        this.callback = t || e.EMPTY_FUNCTION;
        this.config = e.lang.object({}).merge(n).get();
        this.iframe = this._createIframe()
    }, insertInto: function (e) {
        if (typeof e === "string") {
            e = t.getElementById(e)
        }
        e.appendChild(this.iframe)
    }, getIframe: function () {
        return this.iframe
    }, getWindow: function () {
        this._readyError()
    }, getDocument: function () {
        this._readyError()
    }, destroy: function () {
        var e = this.getIframe();
        e.parentNode.removeChild(e)
    }, _readyError: function () {
        throw new Error("wysihtml5.Sandbox: Sandbox iframe isn't loaded yet")
    }, _createIframe: function () {
        var n = this, r = t.createElement("iframe");
        r.className = "wysihtml5-sandbox";
        e.dom.setAttributes({security: "restricted", allowtransparency: "true", frameborder: 0, width: 0, height: 0, marginwidth: 0, marginheight: 0}).on(r);
        if (e.browser.throwsMixedContentWarningWhenIframeSrcIsEmpty()) {
            r.src = "javascript:'<html></html>'"
        }
        r.onload = function () {
            r.onreadystatechange = r.onload = null;
            n._onLoadIframe(r)
        };
        r.onreadystatechange = function () {
            if (/loaded|complete/.test(r.readyState)) {
                r.onreadystatechange = r.onload = null;
                n._onLoadIframe(r)
            }
        };
        return r
    }, _onLoadIframe: function (s) {
        if (!e.dom.contains(t.documentElement, s)) {
            return
        }
        var o = this, u = s.contentWindow, a = s.contentWindow.document, f = t.characterSet || t.charset || "utf-8", l = this._getHtml({charset: f, stylesheets: this.config.stylesheets});
        a.open("text/html", "replace");
        a.write(l);
        a.close();
        this.getWindow = function () {
            return s.contentWindow
        };
        this.getDocument = function () {
            return s.contentWindow.document
        };
        u.onerror = function (e, t, n) {
            throw new Error("wysihtml5.Sandbox: " + e, t, n)
        };
        if (!e.browser.supportsSandboxedIframes()) {
            var c, h;
            for (c = 0, h = n.length; c < h; c++) {
                this._unset(u, n[c])
            }
            for (c = 0, h = r.length; c < h; c++) {
                this._unset(u, r[c], e.EMPTY_FUNCTION)
            }
            for (c = 0, h = i.length; c < h; c++) {
                this._unset(a, i[c])
            }
            this._unset(a, "cookie", "", true)
        }
        this.loaded = true;
        setTimeout(function () {
            o.callback(o)
        }, 0)
    }, _getHtml: function (t) {
        var n = t.stylesheets, r = "", i = 0, s;
        n = typeof n === "string" ? [n] : n;
        if (n) {
            s = n.length;
            for (; i < s; i++) {
                r += '<link rel="stylesheet" href="' + n[i] + '">'
            }
        }
        t.stylesheets = r;
        return e.lang.string("<!DOCTYPE html><html><head>" + '<meta charset="#{charset}">#{stylesheets}</head>' + "<body></body></html>").interpolate(t)
    }, _unset: function (t, n, r, i) {
        try {
            t[n] = r
        } catch (s) {
        }
        try {
            t.__defineGetter__(n, function () {
                return r
            })
        } catch (s) {
        }
        if (i) {
            try {
                t.__defineSetter__(n, function () {
                })
            } catch (s) {
            }
        }
        if (!e.browser.crashesWhenDefineProperty(n)) {
            try {
                var o = {get: function () {
                    return r
                }};
                if (i) {
                    o.set = function () {
                    }
                }
                Object.defineProperty(t, n, o)
            } catch (s) {
            }
        }
    }})
})(wysihtml5);
(function () {
    var e = {className: "class"};
    wysihtml5.dom.setAttributes = function (t) {
        return{on: function (n) {
            for (var r in t) {
                n.setAttribute(e[r] || r, t[r])
            }
        }}
    }
})();
wysihtml5.dom.setStyles = function (e) {
    return{on: function (t) {
        var n = t.style;
        if (typeof e === "string") {
            n.cssText += ";" + e;
            return
        }
        for (var r in e) {
            if (r === "float") {
                n.cssFloat = e[r];
                n.styleFloat = e[r]
            } else {
                n[r] = e[r]
            }
        }
    }}
};
(function (e) {
    e.simulatePlaceholder = function (t, n, r) {
        var i = "placeholder", s = function () {
            if (n.hasPlaceholderSet()) {
                n.clear()
            }
            e.removeClass(n.element, i)
        }, o = function () {
            if (n.isEmpty()) {
                n.setValue(r);
                e.addClass(n.element, i)
            }
        };
        t.observe("set_placeholder", o).observe("unset_placeholder", s).observe("focus:composer", s).observe("paste:composer", s).observe("blur:composer", o);
        o()
    }
})(wysihtml5.dom);
(function (e) {
    var t = document.documentElement;
    if ("textContent"in t) {
        e.setTextContent = function (e, t) {
            e.textContent = t
        };
        e.getTextContent = function (e) {
            return e.textContent
        }
    } else if ("innerText"in t) {
        e.setTextContent = function (e, t) {
            e.innerText = t
        };
        e.getTextContent = function (e) {
            return e.innerText
        }
    } else {
        e.setTextContent = function (e, t) {
            e.nodeValue = t
        };
        e.getTextContent = function (e) {
            return e.nodeValue
        }
    }
})(wysihtml5.dom);
wysihtml5.quirks.cleanPastedHTML = function () {
    function t(t, n, r) {
        n = n || e;
        r = r || t.ownerDocument || document;
        var i, s = typeof t === "string", o, u, a, f, l = 0;
        if (s) {
            i = wysihtml5.dom.getAsDom(t, r)
        } else {
            i = t
        }
        for (f in n) {
            u = i.querySelectorAll(f);
            o = n[f];
            a = u.length;
            for (; l < a; l++) {
                o(u[l])
            }
        }
        u = t = n = null;
        return s ? i.innerHTML : i
    }

    var e = {"a u": wysihtml5.dom.replaceWithChildNodes};
    return t
}();
(function (e) {
    var t = e.dom;
    e.quirks.ensureProperClearing = function () {
        var e = function (e) {
            var t = this;
            setTimeout(function () {
                var e = t.innerHTML.toLowerCase();
                if (e == "<p>&nbsp;</p>" || e == "<p>&nbsp;</p><p>&nbsp;</p>") {
                    t.innerHTML = ""
                }
            }, 0)
        };
        return function (n) {
            t.observe(n.element, ["cut", "keydown"], e)
        }
    }();
    e.quirks.ensureProperClearingOfLists = function () {
        var n = ["OL", "UL", "MENU"];
        var r = function (r, i) {
            if (!i.firstChild || !e.lang.array(n).contains(i.firstChild.nodeName)) {
                return
            }
            var s = t.getParentElement(r, {nodeName: n});
            if (!s) {
                return
            }
            var o = s == i.firstChild;
            if (!o) {
                return
            }
            var u = s.childNodes.length <= 1;
            if (!u) {
                return
            }
            var a = s.firstChild ? s.firstChild.innerHTML === "" : true;
            if (!a) {
                return
            }
            s.parentNode.removeChild(s)
        };
        return function (n) {
            t.observe(n.element, "keydown", function (t) {
                if (t.keyCode !== e.BACKSPACE_KEY) {
                    return
                }
                var i = n.selection.getSelectedNode();
                r(i, n.element)
            })
        }
    }()
})(wysihtml5);
(function (e) {
    var t = "%7E";
    e.quirks.getCorrectInnerHTML = function (n) {
        var r = n.innerHTML;
        if (r.indexOf(t) === -1) {
            return r
        }
        var i = n.querySelectorAll("[href*='~'], [src*='~']"), s, o, u, a;
        for (a = 0, u = i.length; a < u; a++) {
            s = i[a].href || i[a].src;
            o = e.lang.string(s).replace("~").by(t);
            r = e.lang.string(r).replace(o).by(s)
        }
        return r
    }
})(wysihtml5);
(function (e) {
    var t = e.dom, n = ["LI", "P", "H1", "H2", "H3", "H4", "H5", "H6"], r = ["UL", "OL", "MENU"];
    e.quirks.insertLineBreakOnReturn = function (i) {
        function s(n) {
            var r = t.getParentElement(n, {nodeName: ["P", "DIV"]}, 2);
            if (!r) {
                return
            }
            var s = document.createTextNode(e.INVISIBLE_SPACE);
            t.insert(s).before(r);
            t.replaceWithChildNodes(r);
            i.selection.selectNode(s)
        }

        function o(o) {
            var u = o.keyCode;
            if (o.shiftKey || u !== e.ENTER_KEY && u !== e.BACKSPACE_KEY) {
                return
            }
            var a = o.target, f = i.selection.getSelectedNode(), l = t.getParentElement(f, {nodeName: n}, 4);
            if (l) {
                if (l.nodeName === "LI" && (u === e.ENTER_KEY || u === e.BACKSPACE_KEY)) {
                    setTimeout(function () {
                        var e = i.selection.getSelectedNode(), n, o;
                        if (!e) {
                            return
                        }
                        n = t.getParentElement(e, {nodeName: r}, 2);
                        if (n) {
                            return
                        }
                        s(e)
                    }, 0)
                } else if (l.nodeName.match(/H[1-6]/) && u === e.ENTER_KEY) {
                    setTimeout(function () {
                        s(i.selection.getSelectedNode())
                    }, 0)
                }
                return
            }
            if (u === e.ENTER_KEY && !e.browser.insertsLineBreaksOnReturn()) {
                i.commands.exec("insertLineBreak");
                o.preventDefault()
            }
        }

        t.observe(i.element.ownerDocument, "keydown", o)
    }
})(wysihtml5);
(function (e) {
    var t = "wysihtml5-quirks-redraw";
    e.quirks.redraw = function (n) {
        e.dom.addClass(n, t);
        e.dom.removeClass(n, t);
        try {
            var r = n.ownerDocument;
            r.execCommand("italic", false, null);
            r.execCommand("italic", false, null)
        } catch (i) {
        }
    }
})(wysihtml5);
(function (e) {
    function n(e) {
        var t = 0;
        if (e.parentNode) {
            do {
                t += e.offsetTop || 0;
                e = e.offsetParent
            } while (e)
        }
        return t
    }

    var t = e.dom;
    e.Selection = Base.extend({constructor: function (e) {
        window.rangy.init();
        this.editor = e;
        this.composer = e.composer;
        this.doc = this.composer.doc
    }, getBookmark: function () {
        var e = this.getRange();
        return e && e.cloneRange()
    }, setBookmark: function (e) {
        if (!e) {
            return
        }
        this.setSelection(e)
    }, setBefore: function (e) {
        var t = rangy.createRange(this.doc);
        t.setStartBefore(e);
        t.setEndBefore(e);
        return this.setSelection(t)
    }, setAfter: function (e) {
        var t = rangy.createRange(this.doc);
        t.setStartAfter(e);
        t.setEndAfter(e);
        return this.setSelection(t)
    }, selectNode: function (n) {
        var r = rangy.createRange(this.doc), i = n.nodeType === e.ELEMENT_NODE, s = "canHaveHTML"in n ? n.canHaveHTML : n.nodeName !== "IMG", o = i ? n.innerHTML : n.data, u = o === "" || o === e.INVISIBLE_SPACE, a = t.getStyle("display").from(n), f = a === "block" || a === "list-item";
        if (u && i && s) {
            try {
                n.innerHTML = e.INVISIBLE_SPACE
            } catch (l) {
            }
        }
        if (s) {
            r.selectNodeContents(n)
        } else {
            r.selectNode(n)
        }
        if (s && u && i) {
            r.collapse(f)
        } else if (s && u) {
            r.setStartAfter(n);
            r.setEndAfter(n)
        }
        this.setSelection(r)
    }, getSelectedNode: function (e) {
        var t, n;
        if (e && this.doc.selection && this.doc.selection.type === "Control") {
            n = this.doc.selection.createRange();
            if (n && n.length) {
                return n.item(0)
            }
        }
        t = this.getSelection(this.doc);
        if (t.focusNode === t.anchorNode) {
            return t.focusNode
        } else {
            n = this.getRange(this.doc);
            return n ? n.commonAncestorContainer : this.doc.body
        }
    }, executeAndRestore: function (t, n) {
        var r = this.doc.body, i = n && r.scrollTop, s = n && r.scrollLeft, o = "_wysihtml5-temp-placeholder", u = '<span class="' + o + '">' + e.INVISIBLE_SPACE + "</span>", a = this.getRange(this.doc), f;
        if (!a) {
            t(r, r);
            return
        }
        var l = a.createContextualFragment(u);
        a.insertNode(l);
        try {
            t(a.startContainer, a.endContainer)
        } catch (c) {
            setTimeout(function () {
                throw c
            }, 0)
        }
        caretPlaceholder = this.doc.querySelector("." + o);
        if (caretPlaceholder) {
            f = rangy.createRange(this.doc);
            f.selectNode(caretPlaceholder);
            f.deleteContents();
            this.setSelection(f)
        } else {
            r.focus()
        }
        if (n) {
            r.scrollTop = i;
            r.scrollLeft = s
        }
        try {
            caretPlaceholder.parentNode.removeChild(caretPlaceholder)
        } catch (h) {
        }
    }, executeAndRestoreSimple: function (e) {
        var t = this.getRange(), n = this.doc.body, r, i, s, o, u;
        if (!t) {
            e(n, n);
            return
        }
        o = t.getNodes([3]);
        i = o[0] || t.startContainer;
        s = o[o.length - 1] || t.endContainer;
        u = {collapsed: t.collapsed, startContainer: i, startOffset: i === t.startContainer ? t.startOffset : 0, endContainer: s, endOffset: s === t.endContainer ? t.endOffset : s.length};
        try {
            e(t.startContainer, t.endContainer)
        } catch (a) {
            setTimeout(function () {
                throw a
            }, 0)
        }
        r = rangy.createRange(this.doc);
        try {
            r.setStart(u.startContainer, u.startOffset)
        } catch (f) {
        }
        try {
            r.setEnd(u.endContainer, u.endOffset)
        } catch (l) {
        }
        try {
            this.setSelection(r)
        } catch (c) {
        }
    }, insertHTML: function (e) {
        var t = rangy.createRange(this.doc), n = t.createContextualFragment(e), r = n.lastChild;
        this.insertNode(n);
        if (r) {
            this.setAfter(r)
        }
    }, insertNode: function (e) {
        var t = this.getRange();
        if (t) {
            t.insertNode(e)
        }
    }, surround: function (e) {
        var t = this.getRange();
        if (!t) {
            return
        }
        try {
            t.surroundContents(e);
            this.selectNode(e)
        } catch (n) {
            e.appendChild(t.extractContents());
            t.insertNode(e)
        }
    }, scrollIntoView: function () {
        var t = this.doc, r = t.documentElement.scrollHeight > t.documentElement.offsetHeight, i = t._wysihtml5ScrollIntoViewElement = t._wysihtml5ScrollIntoViewElement || function () {
            var n = t.createElement("span");
            n.innerHTML = e.INVISIBLE_SPACE;
            return n
        }(), s;
        if (r) {
            this.insertNode(i);
            s = n(i);
            i.parentNode.removeChild(i);
            if (s > t.body.scrollTop) {
                t.body.scrollTop = s
            }
        }
    }, selectLine: function () {
        if (e.browser.supportsSelectionModify()) {
            this._selectLine_W3C()
        } else if (this.doc.selection) {
            this._selectLine_MSIE()
        }
    }, _selectLine_W3C: function () {
        var e = this.doc.defaultView, t = e.getSelection();
        t.modify("extend", "left", "lineboundary");
        t.modify("extend", "right", "lineboundary")
    }, _selectLine_MSIE: function () {
        var e = this.doc.selection.createRange(), t = e.boundingTop, n = e.boundingHeight, r = this.doc.body.scrollWidth, i, s, o, u, a;
        if (!e.moveToPoint) {
            return
        }
        if (t === 0) {
            o = this.doc.createElement("span");
            this.insertNode(o);
            t = o.offsetTop;
            o.parentNode.removeChild(o)
        }
        t += 1;
        for (u = -10; u < r; u += 2) {
            try {
                e.moveToPoint(u, t);
                break
            } catch (f) {
            }
        }
        i = t;
        s = this.doc.selection.createRange();
        for (a = r; a >= 0; a--) {
            try {
                s.moveToPoint(a, i);
                break
            } catch (l) {
            }
        }
        e.setEndPoint("EndToEnd", s);
        e.select()
    }, getText: function () {
        var e = this.getSelection();
        return e ? e.toString() : ""
    }, getNodes: function (e, t) {
        var n = this.getRange();
        if (n) {
            return n.getNodes([e], t)
        } else {
            return[]
        }
    }, getRange: function () {
        var e = this.getSelection();
        return e && e.rangeCount && e.getRangeAt(0)
    }, getSelection: function () {
        return rangy.getSelection(this.doc.defaultView || this.doc.parentWindow)
    }, setSelection: function (e) {
        var t = this.doc.defaultView || this.doc.parentWindow, n = rangy.getSelection(t);
        return n.setSingleRange(e)
    }})
})(wysihtml5);
(function (e, t) {
    function i(e, t, n) {
        if (!e.className) {
            return false
        }
        var r = e.className.match(n) || [];
        return r[r.length - 1] === t
    }

    function s(e, t, n) {
        if (e.className) {
            o(e, n);
            e.className += " " + t
        } else {
            e.className = t
        }
    }

    function o(e, t) {
        if (e.className) {
            e.className = e.className.replace(t, "")
        }
    }

    function u(e, t) {
        return e.className.replace(r, " ") == t.className.replace(r, " ")
    }

    function a(e) {
        var t = e.parentNode;
        while (e.firstChild) {
            t.insertBefore(e.firstChild, e)
        }
        t.removeChild(e)
    }

    function f(e, t) {
        if (e.attributes.length != t.attributes.length) {
            return false
        }
        for (var n = 0, r = e.attributes.length, i, s, o; n < r; ++n) {
            i = e.attributes[n];
            o = i.name;
            if (o != "class") {
                s = t.attributes.getNamedItem(o);
                if (i.specified != s.specified) {
                    return false
                }
                if (i.specified && i.nodeValue !== s.nodeValue) {
                    return false
                }
            }
        }
        return true
    }

    function l(e, n) {
        if (t.dom.isCharacterDataNode(e)) {
            if (n == 0) {
                return!!e.previousSibling
            } else if (n == e.length) {
                return!!e.nextSibling
            } else {
                return true
            }
        }
        return n > 0 && n < e.childNodes.length
    }

    function c(e, n, r) {
        var i;
        if (t.dom.isCharacterDataNode(n)) {
            if (r == 0) {
                r = t.dom.getNodeIndex(n);
                n = n.parentNode
            } else if (r == n.length) {
                r = t.dom.getNodeIndex(n) + 1;
                n = n.parentNode
            } else {
                i = t.dom.splitDataNode(n, r)
            }
        }
        if (!i) {
            i = n.cloneNode(false);
            if (i.id) {
                i.removeAttribute("id")
            }
            var s;
            while (s = n.childNodes[r]) {
                i.appendChild(s)
            }
            t.dom.insertAfter(i, n)
        }
        return n == e ? i : c(e, i.parentNode, t.dom.getNodeIndex(i))
    }

    function h(t) {
        this.isElementMerge = t.nodeType == e.ELEMENT_NODE;
        this.firstTextNode = this.isElementMerge ? t.lastChild : t;
        this.textNodes = [this.firstTextNode]
    }

    function p(e, t, r, i) {
        this.tagNames = e || [n];
        this.cssClass = t || "";
        this.similarClassRegExp = r;
        this.normalize = i;
        this.applyToAnyTagName = false
    }

    var n = "span";
    var r = /\s+/g;
    h.prototype = {doMerge: function () {
        var e = [], t, n, r;
        for (var i = 0, s = this.textNodes.length; i < s; ++i) {
            t = this.textNodes[i];
            n = t.parentNode;
            e[i] = t.data;
            if (i) {
                n.removeChild(t);
                if (!n.hasChildNodes()) {
                    n.parentNode.removeChild(n)
                }
            }
        }
        this.firstTextNode.data = r = e.join("");
        return r
    }, getLength: function () {
        var e = this.textNodes.length, t = 0;
        while (e--) {
            t += this.textNodes[e].length
        }
        return t
    }, toString: function () {
        var e = [];
        for (var t = 0, n = this.textNodes.length; t < n; ++t) {
            e[t] = "'" + this.textNodes[t].data + "'"
        }
        return"[Merge(" + e.join(",") + ")]"
    }};
    p.prototype = {getAncestorWithClass: function (n) {
        var r;
        while (n) {
            r = this.cssClass ? i(n, this.cssClass, this.similarClassRegExp) : true;
            if (n.nodeType == e.ELEMENT_NODE && t.dom.arrayContains(this.tagNames, n.tagName.toLowerCase()) && r) {
                return n
            }
            n = n.parentNode
        }
        return false
    }, postApply: function (e, t) {
        var n = e[0], r = e[e.length - 1];
        var i = [], s;
        var o = n, u = r;
        var a = 0, f = r.length;
        var l, c;
        for (var p = 0, d = e.length; p < d; ++p) {
            l = e[p];
            c = this.getAdjacentMergeableTextNode(l.parentNode, false);
            if (c) {
                if (!s) {
                    s = new h(c);
                    i.push(s)
                }
                s.textNodes.push(l);
                if (l === n) {
                    o = s.firstTextNode;
                    a = o.length
                }
                if (l === r) {
                    u = s.firstTextNode;
                    f = s.getLength()
                }
            } else {
                s = null
            }
        }
        var v = this.getAdjacentMergeableTextNode(r.parentNode, true);
        if (v) {
            if (!s) {
                s = new h(r);
                i.push(s)
            }
            s.textNodes.push(v)
        }
        if (i.length) {
            for (p = 0, d = i.length; p < d; ++p) {
                i[p].doMerge()
            }
            t.setStart(o, a);
            t.setEnd(u, f)
        }
    }, getAdjacentMergeableTextNode: function (t, n) {
        var r = t.nodeType == e.TEXT_NODE;
        var i = r ? t.parentNode : t;
        var s;
        var o = n ? "nextSibling" : "previousSibling";
        if (r) {
            s = t[o];
            if (s && s.nodeType == e.TEXT_NODE) {
                return s
            }
        } else {
            s = i[o];
            if (s && this.areElementsMergeable(t, s)) {
                return s[n ? "firstChild" : "lastChild"]
            }
        }
        return null
    }, areElementsMergeable: function (e, n) {
        return t.dom.arrayContains(this.tagNames, (e.tagName || "").toLowerCase()) && t.dom.arrayContains(this.tagNames, (n.tagName || "").toLowerCase()) && u(e, n) && f(e, n)
    }, createContainer: function (e) {
        var t = e.createElement(this.tagNames[0]);
        if (this.cssClass) {
            t.className = this.cssClass
        }
        return t
    }, applyToTextNode: function (e) {
        var n = e.parentNode;
        if (n.childNodes.length == 1 && t.dom.arrayContains(this.tagNames, n.tagName.toLowerCase())) {
            if (this.cssClass) {
                s(n, this.cssClass, this.similarClassRegExp)
            }
        } else {
            var r = this.createContainer(t.dom.getDocument(e));
            e.parentNode.insertBefore(r, e);
            r.appendChild(e)
        }
    }, isRemovable: function (n) {
        return t.dom.arrayContains(this.tagNames, n.tagName.toLowerCase()) && e.lang.string(n.className).trim() == this.cssClass
    }, undoToTextNode: function (e, t, n) {
        if (!t.containsNode(n)) {
            var r = t.cloneRange();
            r.selectNode(n);
            if (r.isPointInRange(t.endContainer, t.endOffset) && l(t.endContainer, t.endOffset)) {
                c(n, t.endContainer, t.endOffset);
                t.setEndAfter(n)
            }
            if (r.isPointInRange(t.startContainer, t.startOffset) && l(t.startContainer, t.startOffset)) {
                n = c(n, t.startContainer, t.startOffset)
            }
        }
        if (this.similarClassRegExp) {
            o(n, this.similarClassRegExp)
        }
        if (this.isRemovable(n)) {
            a(n)
        }
    }, applyToRange: function (t) {
        var n = t.getNodes([e.TEXT_NODE]);
        if (!n.length) {
            try {
                var r = this.createContainer(t.endContainer.ownerDocument);
                t.surroundContents(r);
                this.selectNode(t, r);
                return
            } catch (i) {
            }
        }
        t.splitBoundaries();
        n = t.getNodes([e.TEXT_NODE]);
        if (n.length) {
            var s;
            for (var o = 0, u = n.length; o < u; ++o) {
                s = n[o];
                if (!this.getAncestorWithClass(s)) {
                    this.applyToTextNode(s)
                }
            }
            t.setStart(n[0], 0);
            s = n[n.length - 1];
            t.setEnd(s, s.length);
            if (this.normalize) {
                this.postApply(n, t)
            }
        }
    }, undoToRange: function (t) {
        var n = t.getNodes([e.TEXT_NODE]), r, i;
        if (n.length) {
            t.splitBoundaries();
            n = t.getNodes([e.TEXT_NODE])
        } else {
            var s = t.endContainer.ownerDocument, o = s.createTextNode(e.INVISIBLE_SPACE);
            t.insertNode(o);
            t.selectNode(o);
            n = [o]
        }
        for (var u = 0, a = n.length; u < a; ++u) {
            r = n[u];
            i = this.getAncestorWithClass(r);
            if (i) {
                this.undoToTextNode(r, t, i)
            }
        }
        if (a == 1) {
            this.selectNode(t, n[0])
        } else {
            t.setStart(n[0], 0);
            r = n[n.length - 1];
            t.setEnd(r, r.length);
            if (this.normalize) {
                this.postApply(n, t)
            }
        }
    }, selectNode: function (t, n) {
        var r = n.nodeType === e.ELEMENT_NODE, i = "canHaveHTML"in n ? n.canHaveHTML : true, s = r ? n.innerHTML : n.data, o = s === "" || s === e.INVISIBLE_SPACE;
        if (o && r && i) {
            try {
                n.innerHTML = e.INVISIBLE_SPACE
            } catch (u) {
            }
        }
        t.selectNodeContents(n);
        if (o && r) {
            t.collapse(false)
        } else if (o) {
            t.setStartAfter(n);
            t.setEndAfter(n)
        }
    }, getTextSelectedByRange: function (e, t) {
        var n = t.cloneRange();
        n.selectNodeContents(e);
        var r = n.intersection(t);
        var i = r ? r.toString() : "";
        n.detach();
        return i
    }, isAppliedToRange: function (t) {
        var n = [], r, i = t.getNodes([e.TEXT_NODE]);
        if (!i.length) {
            r = this.getAncestorWithClass(t.startContainer);
            return r ? [r] : false
        }
        for (var s = 0, o = i.length, u; s < o; ++s) {
            u = this.getTextSelectedByRange(i[s], t);
            r = this.getAncestorWithClass(i[s]);
            if (u != "" && !r) {
                return false
            } else {
                n.push(r)
            }
        }
        return n
    }, toggleRange: function (e) {
        if (this.isAppliedToRange(e)) {
            this.undoToRange(e)
        } else {
            this.applyToRange(e)
        }
    }};
    e.selection.HTMLApplier = p
})(wysihtml5, rangy);
wysihtml5.Commands = Base.extend({constructor: function (e) {
    this.editor = e;
    this.composer = e.composer;
    this.doc = this.composer.doc
}, support: function (e) {
    return wysihtml5.browser.supportsCommand(this.doc, e)
}, exec: function (e, t) {
    var n = wysihtml5.commands[e], r = wysihtml5.lang.array(arguments).get(), i = n && n.exec, s = null;
    this.editor.fire("beforecommand:composer");
    if (i) {
        r.unshift(this.composer);
        s = i.apply(n, r)
    } else {
        try {
            s = this.doc.execCommand(e, false, t)
        } catch (o) {
        }
    }
    this.editor.fire("aftercommand:composer");
    return s
}, state: function (e, t) {
    var n = wysihtml5.commands[e], r = wysihtml5.lang.array(arguments).get(), i = n && n.state;
    if (i) {
        r.unshift(this.composer);
        return i.apply(n, r)
    } else {
        try {
            return this.doc.queryCommandState(e)
        } catch (s) {
            return false
        }
    }
}, value: function (e) {
    var t = wysihtml5.commands[e], n = t && t.value;
    if (n) {
        return n.call(t, this.composer, e)
    } else {
        try {
            return this.doc.queryCommandValue(e)
        } catch (r) {
            return null
        }
    }
}});
(function (e) {
    var t;
    e.commands.bold = {exec: function (t, n) {
        return e.commands.formatInline.exec(t, n, "b")
    }, state: function (t, n, r) {
        return e.commands.formatInline.state(t, n, "b")
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    function i(e, t) {
        var n = t.length, i = 0, s, o, u;
        for (; i < n; i++) {
            s = t[i];
            o = r.getParentElement(s, {nodeName: "code"});
            u = r.getTextContent(s);
            if (u.match(r.autoLink.URL_REG_EXP) && !o) {
                o = r.renameElement(s, "code")
            } else {
                r.replaceWithChildNodes(s)
            }
        }
    }

    function s(i, s) {
        var o = i.doc, u = "_wysihtml5-temp-" + +(new Date), a = /non-matching-class/g, f = 0, l, c, h, p, d, v, m, g, y;
        e.commands.formatInline.exec(i, t, n, u, a);
        c = o.querySelectorAll(n + "." + u);
        l = c.length;
        for (; f < l; f++) {
            h = c[f];
            h.removeAttribute("class");
            for (y in s) {
                h.setAttribute(y, s[y])
            }
        }
        v = h;
        if (l === 1) {
            m = r.getTextContent(h);
            p = !!h.querySelector("*");
            d = m === "" || m === e.INVISIBLE_SPACE;
            if (!p && d) {
                r.setTextContent(h, s.text || h.href);
                g = o.createTextNode(" ");
                i.selection.setAfter(h);
                i.selection.insertNode(g);
                v = g
            }
        }
        i.selection.setAfter(v)
    }

    var t, n = "A", r = e.dom;
    e.commands.createLink = {exec: function (e, t, n) {
        var r = this.state(e, t);
        if (r) {
            e.selection.executeAndRestore(function () {
                i(e, r)
            })
        } else {
            n = typeof n === "object" ? n : {href: n};
            s(e, n)
        }
    }, state: function (t, n) {
        return e.commands.formatInline.state(t, n, "A")
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t, n = /wysiwyg-font-size-[a-z\-]+/g;
    e.commands.fontSize = {exec: function (t, r, i) {
        return e.commands.formatInline.exec(t, r, "span", "wysiwyg-font-size-" + i, n)
    }, state: function (t, r, i) {
        return e.commands.formatInline.state(t, r, "span", "wysiwyg-font-size-" + i, n)
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t, n = /wysiwyg-color-[a-z]+/g;
    e.commands.foreColor = {exec: function (t, r, i) {
        return e.commands.formatInline.exec(t, r, "span", "wysiwyg-color-" + i, n)
    }, state: function (t, r, i) {
        return e.commands.formatInline.state(t, r, "span", "wysiwyg-color-" + i, n)
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    function s(e, t, n) {
        if (e.className) {
            o(e, n);
            e.className += " " + t
        } else {
            e.className = t
        }
    }

    function o(e, t) {
        e.className = e.className.replace(t, "")
    }

    function u(t) {
        return t.nodeType === e.TEXT_NODE && !e.lang.string(t.data).trim()
    }

    function a(e) {
        var t = e.previousSibling;
        while (t && u(t)) {
            t = t.previousSibling
        }
        return t
    }

    function f(e) {
        var t = e.nextSibling;
        while (t && u(t)) {
            t = t.nextSibling
        }
        return t
    }

    function l(e) {
        var t = e.ownerDocument, n = f(e), r = a(e);
        if (n && !d(n)) {
            e.parentNode.insertBefore(t.createElement("br"), n)
        }
        if (r && !d(r)) {
            e.parentNode.insertBefore(t.createElement("br"), e)
        }
    }

    function c(e) {
        var t = f(e), n = a(e);
        if (t && p(t)) {
            t.parentNode.removeChild(t)
        }
        if (n && p(n)) {
            n.parentNode.removeChild(n)
        }
    }

    function h(e) {
        var t = e.lastChild;
        if (t && p(t)) {
            t.parentNode.removeChild(t)
        }
    }

    function p(e) {
        return e.nodeName === "BR"
    }

    function d(e) {
        if (p(e)) {
            return true
        }
        if (n.getStyle("display").from(e) === "block") {
            return true
        }
        return false
    }

    function v(t, r, i, s) {
        if (s) {
            var o = n.observe(t, "DOMNodeInserted", function (t) {
                var r = t.target, i;
                if (r.nodeType !== e.ELEMENT_NODE) {
                    return
                }
                i = n.getStyle("display").from(r);
                if (i.substr(0, 6) !== "inline") {
                    r.className += " " + s
                }
            })
        }
        t.execCommand(r, false, i);
        if (o) {
            o.stop()
        }
    }

    function m(e, t) {
        e.selection.selectLine();
        e.selection.surround(t);
        c(t);
        h(t);
        e.selection.selectNode(t)
    }

    function g(t) {
        return!!e.lang.string(t.className).trim()
    }

    var t, n = e.dom, r = "DIV", i = ["H1", "H2", "H3", "H4", "H5", "H6", "P", "BLOCKQUOTE", r];
    e.commands.formatBlock = {exec: function (t, u, a, f, c) {
        var h = t.doc, p = this.state(t, u, a, f, c), d;
        a = typeof a === "string" ? a.toUpperCase() : a;
        if (p) {
            t.selection.executeAndRestoreSimple(function () {
                if (c) {
                    o(p, c)
                }
                var e = g(p);
                if (!e && p.nodeName === (a || r)) {
                    l(p);
                    n.replaceWithChildNodes(p)
                } else if (e) {
                    n.renameElement(p, r)
                }
            });
            return
        }
        if (a === null || e.lang.array(i).contains(a)) {
            d = t.selection.getSelectedNode();
            p = n.getParentElement(d, {nodeName: i});
            if (p) {
                t.selection.executeAndRestoreSimple(function () {
                    if (a) {
                        p = n.renameElement(p, a)
                    }
                    if (f) {
                        s(p, f, c)
                    }
                });
                return
            }
        }
        if (t.commands.support(u)) {
            v(h, u, a || r, f);
            return
        }
        p = h.createElement(a || r);
        if (f) {
            p.className = f
        }
        m(t, p)
    }, state: function (e, t, r, i, s) {
        r = typeof r === "string" ? r.toUpperCase() : r;
        var o = e.selection.getSelectedNode();
        return n.getParentElement(o, {nodeName: r, className: i, classRegExp: s})
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    function i(e) {
        var t = n[e];
        return t ? [e.toLowerCase(), t.toLowerCase()] : [e.toLowerCase()]
    }

    function s(t, n, s) {
        var o = t + ":" + n;
        if (!r[o]) {
            r[o] = new e.selection.HTMLApplier(i(t), n, s, true)
        }
        return r[o]
    }

    var t, n = {strong: "b", em: "i", b: "strong", i: "em"}, r = {};
    e.commands.formatInline = {exec: function (e, t, n, r, i) {
        var o = e.selection.getRange();
        if (!o) {
            return false
        }
        s(n, r, i).toggleRange(o);
        e.selection.setSelection(o)
    }, state: function (t, r, i, o, u) {
        var a = t.doc, f = n[i] || i, l;
        if (!e.dom.hasElementWithTagName(a, i) && !e.dom.hasElementWithTagName(a, f)) {
            return false
        }
        if (o && !e.dom.hasElementWithClassName(a, o)) {
            return false
        }
        l = t.selection.getRange();
        if (!l) {
            return false
        }
        return s(i, o, u).isAppliedToRange(l)
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t;
    e.commands.insertHTML = {exec: function (e, t, n) {
        if (e.commands.support(t)) {
            e.doc.execCommand(t, false, n)
        } else {
            e.selection.insertHTML(n)
        }
    }, state: function () {
        return false
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t = "IMG";
    e.commands.insertImage = {exec: function (n, r, i) {
        i = typeof i === "object" ? i : {src: i};
        var s = n.doc, o = this.state(n), u, a, f;
        if (o) {
            n.selection.setBefore(o);
            f = o.parentNode;
            f.removeChild(o);
            e.dom.removeEmptyTextNodes(f);
            if (f.nodeName === "A" && !f.firstChild) {
                n.selection.setAfter(f);
                f.parentNode.removeChild(f)
            }
            e.quirks.redraw(n.element);
            return
        }
        o = s.createElement(t);
        for (a in i) {
            o[a] = i[a]
        }
        n.selection.insertNode(o);
        if (e.browser.hasProblemsSettingCaretAfterImg()) {
            u = s.createTextNode(e.INVISIBLE_SPACE);
            n.selection.insertNode(u);
            n.selection.setAfter(u)
        } else {
            n.selection.setAfter(o)
        }
    }, state: function (n) {
        var r = n.doc, i, s, o;
        if (!e.dom.hasElementWithTagName(r, t)) {
            return false
        }
        i = n.selection.getSelectedNode();
        if (!i) {
            return false
        }
        if (i.nodeName === t) {
            return i
        }
        if (i.nodeType !== e.ELEMENT_NODE) {
            return false
        }
        s = n.selection.getText();
        s = e.lang.string(s).trim();
        if (s) {
            return false
        }
        o = n.selection.getNodes(e.ELEMENT_NODE, function (e) {
            return e.nodeName === "IMG"
        });
        if (o.length !== 1) {
            return false
        }
        return o[0]
    }, value: function (e) {
        var t = this.state(e);
        return t && t.src
    }}
})(wysihtml5);
(function (e) {
    var t, n = "<br>" + (e.browser.needsSpaceAfterLineBreak() ? " " : "");
    e.commands.insertLineBreak = {exec: function (t, r) {
        if (t.commands.support(r)) {
            t.doc.execCommand(r, false, null);
            if (!e.browser.autoScrollsToCaret()) {
                t.selection.scrollIntoView()
            }
        } else {
            t.commands.exec("insertHTML", n)
        }
    }, state: function () {
        return false
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t;
    e.commands.insertOrderedList = {exec: function (t, n) {
        var r = t.doc, i = t.selection.getSelectedNode(), s = e.dom.getParentElement(i, {nodeName: "OL"}), o = e.dom.getParentElement(i, {nodeName: "UL"}), u = "_wysihtml5-temp-" + (new Date).getTime(), a, f;
        if (t.commands.support(n)) {
            r.execCommand(n, false, null);
            return
        }
        if (s) {
            t.selection.executeAndRestoreSimple(function () {
                e.dom.resolveList(s)
            })
        } else if (o) {
            t.selection.executeAndRestoreSimple(function () {
                e.dom.renameElement(o, "ol")
            })
        } else {
            t.commands.exec("formatBlock", "div", u);
            f = r.querySelector("." + u);
            a = f.innerHTML === "" || f.innerHTML === e.INVISIBLE_SPACE;
            t.selection.executeAndRestoreSimple(function () {
                s = e.dom.convertToList(f, "ol")
            });
            if (a) {
                t.selection.selectNode(s.querySelector("li"))
            }
        }
    }, state: function (t) {
        var n = t.selection.getSelectedNode();
        return e.dom.getParentElement(n, {nodeName: "OL"})
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t;
    e.commands.insertUnorderedList = {exec: function (t, n) {
        var r = t.doc, i = t.selection.getSelectedNode(), s = e.dom.getParentElement(i, {nodeName: "UL"}), o = e.dom.getParentElement(i, {nodeName: "OL"}), u = "_wysihtml5-temp-" + (new Date).getTime(), a, f;
        if (t.commands.support(n)) {
            r.execCommand(n, false, null);
            return
        }
        if (s) {
            t.selection.executeAndRestoreSimple(function () {
                e.dom.resolveList(s)
            })
        } else if (o) {
            t.selection.executeAndRestoreSimple(function () {
                e.dom.renameElement(o, "ul")
            })
        } else {
            t.commands.exec("formatBlock", "div", u);
            f = r.querySelector("." + u);
            a = f.innerHTML === "" || f.innerHTML === e.INVISIBLE_SPACE;
            t.selection.executeAndRestoreSimple(function () {
                s = e.dom.convertToList(f, "ul")
            });
            if (a) {
                t.selection.selectNode(s.querySelector("li"))
            }
        }
    }, state: function (t) {
        var n = t.selection.getSelectedNode();
        return e.dom.getParentElement(n, {nodeName: "UL"})
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t;
    e.commands.italic = {exec: function (t, n) {
        return e.commands.formatInline.exec(t, n, "i")
    }, state: function (t, n, r) {
        return e.commands.formatInline.state(t, n, "i")
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t, n = "wysiwyg-text-align-center", r = /wysiwyg-text-align-[a-z]+/g;
    e.commands.justifyCenter = {exec: function (t, i) {
        return e.commands.formatBlock.exec(t, "formatBlock", null, n, r)
    }, state: function (t, i) {
        return e.commands.formatBlock.state(t, "formatBlock", null, n, r)
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t, n = "wysiwyg-text-align-left", r = /wysiwyg-text-align-[a-z]+/g;
    e.commands.justifyLeft = {exec: function (t, i) {
        return e.commands.formatBlock.exec(t, "formatBlock", null, n, r)
    }, state: function (t, i) {
        return e.commands.formatBlock.state(t, "formatBlock", null, n, r)
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t, n = "wysiwyg-text-align-right", r = /wysiwyg-text-align-[a-z]+/g;
    e.commands.justifyRight = {exec: function (t, i) {
        return e.commands.formatBlock.exec(t, "formatBlock", null, n, r)
    }, state: function (t, i) {
        return e.commands.formatBlock.state(t, "formatBlock", null, n, r)
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    var t;
    e.commands.underline = {exec: function (t, n) {
        return e.commands.formatInline.exec(t, n, "u")
    }, state: function (t, n) {
        return e.commands.formatInline.state(t, n, "u")
    }, value: function () {
        return t
    }}
})(wysihtml5);
(function (e) {
    function f(e) {
        var t;
        while (t = e.querySelector("._wysihtml5-temp")) {
            t.parentNode.removeChild(t)
        }
    }

    var t = 90, n = 89, r = 8, i = 46, s = 40, o = '<span id="_wysihtml5-undo" class="_wysihtml5-temp">' + e.INVISIBLE_SPACE + "</span>", u = '<span id="_wysihtml5-redo" class="_wysihtml5-temp">' + e.INVISIBLE_SPACE + "</span>", a = e.dom;
    e.UndoManager = e.lang.Dispatcher.extend({constructor: function (e) {
        this.editor = e;
        this.composer = e.composer;
        this.element = this.composer.element;
        this.history = [this.composer.getValue()];
        this.position = 1;
        if (this.composer.commands.support("insertHTML")) {
            this._observe()
        }
    }, _observe: function () {
        var s = this, l = this.composer.sandbox.getDocument(), c;
        a.observe(this.element, "keydown", function (e) {
            if (e.altKey || !e.ctrlKey && !e.metaKey) {
                return
            }
            var r = e.keyCode, i = r === t && !e.shiftKey, o = r === t && e.shiftKey || r === n;
            if (i) {
                s.undo();
                e.preventDefault()
            } else if (o) {
                s.redo();
                e.preventDefault()
            }
        });
        a.observe(this.element, "keydown", function (e) {
            var t = e.keyCode;
            if (t === c) {
                return
            }
            c = t;
            if (t === r || t === i) {
                s.transact()
            }
        });
        if (e.browser.hasUndoInContextMenu()) {
            var h, p, d = function () {
                f(l);
                clearInterval(h)
            };
            a.observe(this.element, "contextmenu", function () {
                d();
                s.composer.selection.executeAndRestoreSimple(function () {
                    if (s.element.lastChild) {
                        s.composer.selection.setAfter(s.element.lastChild)
                    }
                    l.execCommand("insertHTML", false, o);
                    l.execCommand("insertHTML", false, u);
                    l.execCommand("undo", false, null)
                });
                h = setInterval(function () {
                    if (l.getElementById("_wysihtml5-redo")) {
                        d();
                        s.redo()
                    } else if (!l.getElementById("_wysihtml5-undo")) {
                        d();
                        s.undo()
                    }
                }, 400);
                if (!p) {
                    p = true;
                    a.observe(document, "mousedown", d);
                    a.observe(l, ["mousedown", "paste", "cut", "copy"], d)
                }
            })
        }
        this.editor.observe("newword:composer",function () {
            s.transact()
        }).observe("beforecommand:composer", function () {
            s.transact()
        })
    }, transact: function () {
        var e = this.history[this.position - 1], t = this.composer.getValue();
        if (t == e) {
            return
        }
        var n = this.history.length = this.position;
        if (n > s) {
            this.history.shift();
            this.position--
        }
        this.position++;
        this.history.push(t)
    }, undo: function () {
        this.transact();
        if (this.position <= 1) {
            return
        }
        this.set(this.history[--this.position - 1]);
        this.editor.fire("undo:composer")
    }, redo: function () {
        if (this.position >= this.history.length) {
            return
        }
        this.set(this.history[++this.position - 1]);
        this.editor.fire("redo:composer")
    }, set: function (e) {
        this.composer.setValue(e);
        this.editor.focus(true)
    }})
})(wysihtml5);
wysihtml5.views.View = Base.extend({constructor: function (e, t, n) {
    this.parent = e;
    this.element = t;
    this.config = n;
    this._observeViewChange()
}, _observeViewChange: function () {
    var e = this;
    this.parent.observe("beforeload", function () {
        e.parent.observe("change_view", function (t) {
            if (t === e.name) {
                e.parent.currentView = e;
                e.show();
                setTimeout(function () {
                    e.focus()
                }, 0)
            } else {
                e.hide()
            }
        })
    })
}, focus: function () {
    if (this.element.ownerDocument.querySelector(":focus") === this.element) {
        return
    }
    try {
        this.element.focus()
    } catch (e) {
    }
}, hide: function () {
    this.element.style.display = "none"
}, show: function () {
    this.element.style.display = ""
}, disable: function () {
    this.element.setAttribute("disabled", "disabled")
}, enable: function () {
    this.element.removeAttribute("disabled")
}});
(function (e) {
    var t = e.dom, n = e.browser;
    e.views.Composer = e.views.View.extend({name: "composer", CARET_HACK: "<br>", constructor: function (e, t, n) {
        this.base(e, t, n);
        this.textarea = this.parent.textarea;
        this._initSandbox()
    }, clear: function () {
        this.element.innerHTML = n.displaysCaretInEmptyContentEditableCorrectly() ? "" : this.CARET_HACK
    }, getValue: function (t) {
        var n = this.isEmpty() ? "" : e.quirks.getCorrectInnerHTML(this.element);
        if (t) {
            n = this.parent.parse(n)
        }
        n = e.lang.string(n).replace(e.INVISIBLE_SPACE).by("");
        return n
    }, setValue: function (e, t) {
        if (t) {
            e = this.parent.parse(e)
        }
        this.element.innerHTML = e
    }, show: function () {
        this.iframe.style.display = this._displayStyle || "";
        this.disable();
        this.enable()
    }, hide: function () {
        this._displayStyle = t.getStyle("display").from(this.iframe);
        if (this._displayStyle === "none") {
            this._displayStyle = null
        }
        this.iframe.style.display = "none"
    }, disable: function () {
        this.element.removeAttribute("contentEditable");
        this.base()
    }, enable: function () {
        this.element.setAttribute("contentEditable", "true");
        this.base()
    }, focus: function (t) {
        if (e.browser.doesAsyncFocus() && this.hasPlaceholderSet()) {
            this.clear()
        }
        this.base();
        var n = this.element.lastChild;
        if (t && n) {
            if (n.nodeName === "BR") {
                this.selection.setBefore(this.element.lastChild)
            } else {
                this.selection.setAfter(this.element.lastChild)
            }
        }
    }, getTextContent: function () {
        return t.getTextContent(this.element)
    }, hasPlaceholderSet: function () {
        return this.getTextContent() == this.textarea.element.getAttribute("placeholder")
    }, isEmpty: function () {
        var e = this.element.innerHTML, t = "blockquote, ul, ol, img, embed, object, table, iframe, svg, video, audio, button, input, select, textarea";
        return e === "" || e === this.CARET_HACK || this.hasPlaceholderSet() || this.getTextContent() === "" && !this.element.querySelector(t)
    }, _initSandbox: function () {
        var e = this;
        this.sandbox = new t.Sandbox(function () {
            e._create()
        }, {stylesheets: this.config.stylesheets});
        this.iframe = this.sandbox.getIframe();
        var n = document.createElement("input");
        n.type = "hidden";
        n.name = "_wysihtml5_mode";
        n.value = 1;
        var r = this.textarea.element;
        t.insert(this.iframe).after(r);
        t.insert(n).after(r)
    }, _create: function () {
        var r = this;
        this.doc = this.sandbox.getDocument();
        this.element = this.doc.body;
        this.textarea = this.parent.textarea;
        this.element.innerHTML = this.textarea.getValue(true);
        this.enable();
        this.selection = new e.Selection(this.parent);
        this.commands = new e.Commands(this.parent);
        t.copyAttributes(["className", "spellcheck", "title", "lang", "dir", "accessKey"]).from(this.textarea.element).to(this.element);
        t.addClass(this.element, this.config.composerClassName);
        if (this.config.style) {
            this.style()
        }
        this.observe();
        var i = this.config.name;
        if (i) {
            t.addClass(this.element, i);
            t.addClass(this.iframe, i)
        }
        var s = typeof this.config.placeholder === "string" ? this.config.placeholder : this.textarea.element.getAttribute("placeholder");
        if (s) {
            t.simulatePlaceholder(this.parent, this, s)
        }
        this.commands.exec("styleWithCSS", false);
        this._initAutoLinking();
        this._initObjectResizing();
        this._initUndoManager();
        if (this.textarea.element.hasAttribute("autofocus") || document.querySelector(":focus") == this.textarea.element) {
            setTimeout(function () {
                r.focus()
            }, 100)
        }
        e.quirks.insertLineBreakOnReturn(this);
        if (!n.clearsContentEditableCorrectly()) {
            e.quirks.ensureProperClearing(this)
        }
        if (!n.clearsListsInContentEditableCorrectly()) {
            e.quirks.ensureProperClearingOfLists(this)
        }
        if (this.initSync && this.config.sync) {
            this.initSync()
        }
        this.textarea.hide();
        this.parent.fire("beforeload").fire("load")
    }, _initAutoLinking: function () {
        var r = this, i = n.canDisableAutoLinking(), s = n.doesAutoLinkingInContentEditable();
        if (i) {
            this.commands.exec("autoUrlDetect", false)
        }
        if (!this.config.autoLink) {
            return
        }
        if (!s || s && i) {
            this.parent.observe("newword:composer", function () {
                r.selection.executeAndRestore(function (e, n) {
                    t.autoLink(n.parentNode)
                })
            })
        }
        var o = this.sandbox.getDocument().getElementsByTagName("a"), u = t.autoLink.URL_REG_EXP, a = function (n) {
            var r = e.lang.string(t.getTextContent(n)).trim();
            if (r.substr(0, 4) === "www.") {
                r = "http://" + r
            }
            return r
        };
        t.observe(this.element, "keydown", function (e) {
            if (!o.length) {
                return
            }
            var n = r.selection.getSelectedNode(e.target.ownerDocument), i = t.getParentElement(n, {nodeName: "A"}, 4), s;
            if (!i) {
                return
            }
            s = a(i);
            setTimeout(function () {
                var e = a(i);
                if (e === s) {
                    return
                }
                if (e.match(u)) {
                    i.setAttribute("href", e)
                }
            }, 0)
        })
    }, _initObjectResizing: function () {
        var r = ["width", "height"], i = r.length, s = this.element;
        this.commands.exec("enableObjectResizing", this.config.allowObjectResizing);
        if (this.config.allowObjectResizing) {
            if (n.supportsEvent("resizeend")) {
                t.observe(s, "resizeend", function (t) {
                    var n = t.target || t.srcElement, o = n.style, u = 0, a;
                    for (; u < i; u++) {
                        a = r[u];
                        if (o[a]) {
                            n.setAttribute(a, parseInt(o[a], 10));
                            o[a] = ""
                        }
                    }
                    e.quirks.redraw(s)
                })
            }
        } else {
            if (n.supportsEvent("resizestart")) {
                t.observe(s, "resizestart", function (e) {
                    e.preventDefault()
                })
            }
        }
    }, _initUndoManager: function () {
        new e.UndoManager(this.parent)
    }})
})(wysihtml5);
(function (e) {
    var t = e.dom, n = document, r = window, i = n.createElement("div"), s = ["background-color", "color", "cursor", "font-family", "font-size", "font-style", "font-variant", "font-weight", "line-height", "letter-spacing", "text-align", "text-decoration", "text-indent", "text-rendering", "word-break", "word-wrap", "word-spacing"], o = ["background-color", "border-collapse", "border-bottom-color", "border-bottom-style", "border-bottom-width", "border-left-color", "border-left-style", "border-left-width", "border-right-color", "border-right-style", "border-right-width", "border-top-color", "border-top-style", "border-top-width", "clear", "display", "float", "margin-bottom", "margin-left", "margin-right", "margin-top", "outline-color", "outline-offset", "outline-width", "outline-style", "padding-left", "padding-right", "padding-top", "padding-bottom", "position", "top", "left", "right", "bottom", "z-index", "vertical-align", "text-align", "-webkit-box-sizing", "-moz-box-sizing", "-ms-box-sizing", "box-sizing", "-webkit-box-shadow", "-moz-box-shadow", "-ms-box-shadow", "box-shadow", "-webkit-border-top-right-radius", "-moz-border-radius-topright", "border-top-right-radius", "-webkit-border-bottom-right-radius", "-moz-border-radius-bottomright", "border-bottom-right-radius", "-webkit-border-bottom-left-radius", "-moz-border-radius-bottomleft", "border-bottom-left-radius", "-webkit-border-top-left-radius", "-moz-border-radius-topleft", "border-top-left-radius", "width", "height"], u = ["width", "height", "top", "left", "right", "bottom"], a = ["html             { height: 100%; }", "body             { min-height: 100%; padding: 0; margin: 0; margin-top: -1px; padding-top: 1px; }", "._wysihtml5-temp { display: none; }", e.browser.isGecko ? "body.placeholder { color: graytext !important; }" : "body.placeholder { color: #a9a9a9 !important; }", "body[disabled]   { background-color: #eee !important; color: #999 !important; cursor: default !important; }", "img:-moz-broken  { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"];
    var f = function (e) {
        if (e.setActive) {
            try {
                e.setActive()
            } catch (i) {
            }
        } else {
            var s = e.style, o = n.documentElement.scrollTop || n.body.scrollTop, u = n.documentElement.scrollLeft || n.body.scrollLeft, a = {position: s.position, top: s.top, left: s.left, WebkitUserSelect: s.WebkitUserSelect};
            t.setStyles({position: "absolute", top: "-99999px", left: "-99999px", WebkitUserSelect: "none"}).on(e);
            e.focus();
            t.setStyles(a).on(e);
            if (r.scrollTo) {
                r.scrollTo(u, o)
            }
        }
    };
    e.views.Composer.prototype.style = function () {
        var l = this, c = n.querySelector(":focus"), h = this.textarea.element, p = h.hasAttribute("placeholder"), d = p && h.getAttribute("placeholder");
        this.focusStylesHost = this.focusStylesHost || i.cloneNode(false);
        this.blurStylesHost = this.blurStylesHost || i.cloneNode(false);
        if (p) {
            h.removeAttribute("placeholder")
        }
        if (h === c) {
            h.blur()
        }
        t.copyStyles(o).from(h).to(this.iframe).andTo(this.blurStylesHost);
        t.copyStyles(s).from(h).to(this.element).andTo(this.blurStylesHost);
        t.insertCSS(a).into(this.element.ownerDocument);
        f(h);
        t.copyStyles(o).from(h).to(this.focusStylesHost);
        t.copyStyles(s).from(h).to(this.focusStylesHost);
        var v = e.lang.array(o).without(["display"]);
        if (c) {
            c.focus()
        } else {
            h.blur()
        }
        if (p) {
            h.setAttribute("placeholder", d)
        }
        if (!e.browser.hasCurrentStyleProperty()) {
            var m = t.observe(r, "resize", function () {
                if (!t.contains(document.documentElement, l.iframe)) {
                    m.stop();
                    return
                }
                var e = t.getStyle("display").from(h), n = t.getStyle("display").from(l.iframe);
                h.style.display = "";
                l.iframe.style.display = "none";
                t.copyStyles(u).from(h).to(l.iframe).andTo(l.focusStylesHost).andTo(l.blurStylesHost);
                l.iframe.style.display = n;
                h.style.display = e
            })
        }
        this.parent.observe("focus:composer", function () {
            t.copyStyles(v).from(l.focusStylesHost).to(l.iframe);
            t.copyStyles(s).from(l.focusStylesHost).to(l.element)
        });
        this.parent.observe("blur:composer", function () {
            t.copyStyles(v).from(l.blurStylesHost).to(l.iframe);
            t.copyStyles(s).from(l.blurStylesHost).to(l.element)
        });
        return this
    }
})(wysihtml5);
(function (e) {
    var t = e.dom, n = e.browser, r = {66: "bold", 73: "italic", 85: "underline"};
    e.views.Composer.prototype.observe = function () {
        var i = this, s = this.getValue(), o = this.sandbox.getIframe(), u = this.element, a = n.supportsEventsInIframeCorrectly() ? u : this.sandbox.getWindow(), f = n.supportsEvent("drop") ? ["drop", "paste"] : ["dragdrop", "paste"];
        t.observe(o, "DOMNodeRemoved", function () {
            clearInterval(l);
            i.parent.fire("destroy:composer")
        });
        var l = setInterval(function () {
            if (!t.contains(document.documentElement, o)) {
                clearInterval(l);
                i.parent.fire("destroy:composer")
            }
        }, 250);
        t.observe(a, "focus", function () {
            i.parent.fire("focus").fire("focus:composer");
            setTimeout(function () {
                s = i.getValue()
            }, 0)
        });
        t.observe(a, "blur", function () {
            if (s !== i.getValue()) {
                i.parent.fire("change").fire("change:composer")
            }
            i.parent.fire("blur").fire("blur:composer")
        });
        if (e.browser.isIos()) {
            t.observe(u, "blur", function () {
                var e = u.ownerDocument.createElement("input"), t = document.documentElement.scrollTop || document.body.scrollTop, n = document.documentElement.scrollLeft || document.body.scrollLeft;
                try {
                    i.selection.insertNode(e)
                } catch (r) {
                    u.appendChild(e)
                }
                e.focus();
                e.parentNode.removeChild(e);
                window.scrollTo(n, t)
            })
        }
        t.observe(u, "dragenter", function () {
            i.parent.fire("unset_placeholder")
        });
        if (n.firesOnDropOnlyWhenOnDragOverIsCancelled()) {
            t.observe(u, ["dragover", "dragenter"], function (e) {
                e.preventDefault()
            })
        }
        t.observe(u, f, function (e) {
            var t = e.dataTransfer, r;
            console.log("PASTED", e);
            if (t && n.supportsDataTransfer()) {
                r = t.getData("text/html") || t.getData("text/plain")
            }
            if (r) {
                u.focus();
                i.commands.exec("insertHTML", r);
                i.parent.fire("paste").fire("paste:composer");
                e.stopPropagation();
                e.preventDefault()
            } else {
                setTimeout(function () {
                    i.parent.fire("paste").fire("paste:composer")
                }, 0)
            }
        });
        t.observe(u, "keyup", function (t) {
            var n = t.keyCode;
            if (n === e.SPACE_KEY || n === e.ENTER_KEY) {
                i.parent.fire("newword:composer")
            }
        });
        this.parent.observe("paste:composer", function () {
            setTimeout(function () {
                i.parent.fire("newword:composer")
            }, 0)
        });
        if (!n.canSelectImagesInContentEditable()) {
            t.observe(u, "mousedown", function (e) {
                var t = e.target;
                if (t.nodeName === "IMG") {
                    i.selection.selectNode(t);
                    e.preventDefault()
                }
            })
        }
        t.observe(u, "keydown", function (e) {
            var t = e.keyCode, n = r[t];
            if ((e.ctrlKey || e.metaKey) && !e.altKey && n) {
                i.commands.exec(n);
                e.preventDefault()
            }
        });
        t.observe(u, "keydown", function (t) {
            var n = i.selection.getSelectedNode(true), r = t.keyCode, s;
            if (n && n.nodeName === "IMG" && (r === e.BACKSPACE_KEY || r === e.DELETE_KEY)) {
                s = n.parentNode;
                s.removeChild(n);
                if (s.nodeName === "A" && !s.firstChild) {
                    s.parentNode.removeChild(s)
                }
                setTimeout(function () {
                    e.quirks.redraw(u)
                }, 0);
                t.preventDefault()
            }
        });
        var c = {IMG: "Image: ", A: "Link: "};
        t.observe(u, "mouseover", function (e) {
            var t = e.target, n = t.nodeName, r;
            if (n !== "A" && n !== "IMG") {
                return
            }
            var i = t.hasAttribute("title");
            if (!i) {
                r = c[n] + (t.getAttribute("href") || t.getAttribute("src"));
                t.setAttribute("title", r)
            }
        })
    }
})(wysihtml5);
(function (e) {
    var t = 400;
    e.views.Synchronizer = Base.extend({constructor: function (e, t, n) {
        this.editor = e;
        this.textarea = t;
        this.composer = n;
        this._observe()
    }, fromComposerToTextarea: function (t) {
        this.textarea.setValue(e.lang.string(this.composer.getValue()).trim(), t)
    }, fromTextareaToComposer: function (e) {
        var t = this.textarea.getValue();
        if (t) {
            this.composer.setValue(t, e)
        } else {
            this.composer.clear();
            this.editor.fire("set_placeholder")
        }
    }, sync: function (e) {
        if (this.editor.currentView.name === "textarea") {
            this.fromTextareaToComposer(e)
        } else {
            this.fromComposerToTextarea(e)
        }
    }, _observe: function () {
        var n, r = this, i = this.textarea.element.form, s = function () {
            n = setInterval(function () {
                r.fromComposerToTextarea()
            }, t)
        }, o = function () {
            clearInterval(n);
            n = null
        };
        s();
        if (i) {
            e.dom.observe(i, "submit", function () {
                r.sync(true)
            });
            e.dom.observe(i, "reset", function () {
                setTimeout(function () {
                    r.fromTextareaToComposer()
                }, 0)
            })
        }
        this.editor.observe("change_view", function (e) {
            if (e === "composer" && !n) {
                r.fromTextareaToComposer(true);
                s()
            } else if (e === "textarea") {
                r.fromComposerToTextarea(true);
                o()
            }
        });
        this.editor.observe("destroy:composer", o)
    }})
})(wysihtml5);
wysihtml5.views.Textarea = wysihtml5.views.View.extend({name: "textarea", constructor: function (e, t, n) {
    this.base(e, t, n);
    this._observe()
}, clear: function () {
    this.element.value = ""
}, getValue: function (e) {
    var t = this.isEmpty() ? "" : this.element.value;
    if (e) {
        t = this.parent.parse(t)
    }
    return t
}, setValue: function (e, t) {
    if (t) {
        e = this.parent.parse(e)
    }
    this.element.value = e
}, hasPlaceholderSet: function () {
    var e = wysihtml5.browser.supportsPlaceholderAttributeOn(this.element), t = this.element.getAttribute("placeholder") || null, n = this.element.value, r = !n;
    return e && r || n === t
}, isEmpty: function () {
    return!wysihtml5.lang.string(this.element.value).trim() || this.hasPlaceholderSet()
}, _observe: function () {
    var e = this.element, t = this.parent, n = {focusin: "focus", focusout: "blur"}, r = wysihtml5.browser.supportsEvent("focusin") ? ["focusin", "focusout", "change"] : ["focus", "blur", "change"];
    t.observe("beforeload", function () {
        wysihtml5.dom.observe(e, r, function (e) {
            var r = n[e.type] || e.type;
            t.fire(r).fire(r + ":textarea")
        });
        wysihtml5.dom.observe(e, ["paste", "drop"], function () {
            setTimeout(function () {
                t.fire("paste").fire("paste:textarea")
            }, 0)
        })
    })
}});
(function (e) {
    var t = e.dom, n = "wysihtml5-command-dialog-opened", r = "input, select, textarea", i = "[data-wysihtml5-dialog-field]", s = "data-wysihtml5-dialog-field";
    e.toolbar.Dialog = e.lang.Dispatcher.extend({constructor: function (e, t) {
        this.link = e;
        this.container = t
    }, _observe: function () {
        if (this._observed) {
            return
        }
        var i = this, s = function (e) {
            var t = i._serialize();
            if (t == i.elementToChange) {
                i.fire("edit", t)
            } else {
                i.fire("save", t)
            }
            i.hide();
            e.preventDefault();
            e.stopPropagation()
        };
        t.observe(i.link, "click", function (e) {
            if (t.hasClass(i.link, n)) {
                setTimeout(function () {
                    i.hide()
                }, 0)
            }
        });
        t.observe(this.container, "keydown", function (t) {
            var n = t.keyCode;
            if (n === e.ENTER_KEY) {
                s(t)
            }
            if (n === e.ESCAPE_KEY) {
                i.hide()
            }
        });
        t.delegate(this.container, "[data-wysihtml5-dialog-action=save]", "click", s);
        t.delegate(this.container, "[data-wysihtml5-dialog-action=cancel]", "click", function (e) {
            i.fire("cancel");
            i.hide();
            e.preventDefault();
            e.stopPropagation()
        });
        var o = this.container.querySelectorAll(r), u = 0, a = o.length, f = function () {
            clearInterval(i.interval)
        };
        for (; u < a; u++) {
            t.observe(o[u], "change", f)
        }
        this._observed = true
    }, _serialize: function () {
        var e = this.elementToChange || {}, t = this.container.querySelectorAll(i), n = t.length, r = 0;
        for (; r < n; r++) {
            e[t[r].getAttribute(s)] = t[r].value
        }
        return e
    }, _interpolate: function (e) {
        var t, n, r, o = document.querySelector(":focus"), u = this.container.querySelectorAll(i), a = u.length, f = 0;
        for (; f < a; f++) {
            t = u[f];
            if (t === o) {
                continue
            }
            if (e && t.type === "hidden") {
                continue
            }
            n = t.getAttribute(s);
            r = this.elementToChange ? this.elementToChange[n] || "" : t.defaultValue;
            t.value = r
        }
    }, show: function (e) {
        var i = this, s = this.container.querySelector(r);
        this.elementToChange = e;
        this._observe();
        this._interpolate();
        if (e) {
            this.interval = setInterval(function () {
                i._interpolate(true)
            }, 500)
        }
        t.addClass(this.link, n);
        this.container.style.display = "";
        this.fire("show");
        if (s && !e) {
            try {
                s.focus()
            } catch (o) {
            }
        }
    }, hide: function () {
        clearInterval(this.interval);
        this.elementToChange = null;
        t.removeClass(this.link, n);
        this.container.style.display = "none";
        this.fire("hide")
    }})
})(wysihtml5);
(function (e) {
    var t = e.dom;
    var n = {position: "relative"};
    var r = {left: 0, margin: 0, opacity: 0, overflow: "hidden", padding: 0, position: "absolute", top: 0, zIndex: 1};
    var i = {cursor: "inherit", fontSize: "50px", height: "50px", marginTop: "-25px", outline: 0, padding: 0, position: "absolute", right: "-4px", top: "50%"};
    var s = {"x-webkit-speech": "", speech: ""};
    e.toolbar.Speech = function (o, u) {
        var a = document.createElement("input");
        if (!e.browser.supportsSpeechApiOn(a)) {
            u.style.display = "none";
            return
        }
        var f = document.createElement("div");
        e.lang.object(r).merge({width: u.offsetWidth + "px", height: u.offsetHeight + "px"});
        t.insert(a).into(f);
        t.insert(f).into(u);
        t.setStyles(i).on(a);
        t.setAttributes(s).on(a);
        t.setStyles(r).on(f);
        t.setStyles(n).on(u);
        var l = "onwebkitspeechchange"in a ? "webkitspeechchange" : "speechchange";
        t.observe(a, l, function () {
            o.execCommand("insertText", a.value);
            a.value = ""
        });
        t.observe(a, "click", function (e) {
            if (t.hasClass(u, "wysihtml5-command-disabled")) {
                e.preventDefault()
            }
            e.stopPropagation()
        })
    }
})(wysihtml5);
(function (e) {
    var t = "wysihtml5-command-disabled", n = "wysihtml5-commands-disabled", r = "wysihtml5-command-active", i = "wysihtml5-action-active", s = e.dom;
    e.toolbar.Toolbar = Base.extend({constructor: function (t, n) {
        this.editor = t;
        this.container = typeof n === "string" ? document.getElementById(n) : n;
        this.composer = t.composer;
        this._getLinks("command");
        this._getLinks("action");
        this._observe();
        this.show();
        var r = this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"), i = r.length, s = 0;
        for (; s < i; s++) {
            new e.toolbar.Speech(this, r[s])
        }
    }, _getLinks: function (t) {
        var n = this[t + "Links"] = e.lang.array(this.container.querySelectorAll("[data-wysihtml5-" + t + "]")).get(), r = n.length, i = 0, s = this[t + "Mapping"] = {}, o, u, a, f, l;
        for (; i < r; i++) {
            o = n[i];
            a = o.getAttribute("data-wysihtml5-" + t);
            f = o.getAttribute("data-wysihtml5-" + t + "-value");
            u = this.container.querySelector("[data-wysihtml5-" + t + "-group='" + a + "']");
            l = this._getDialog(o, a);
            s[a + ":" + f] = {link: o, group: u, name: a, value: f, dialog: l, state: false}
        }
    }, _getDialog: function (t, n) {
        var r = this, i = this.container.querySelector("[data-wysihtml5-dialog='" + n + "']"), s, o;
        if (i) {
            s = new e.toolbar.Dialog(t, i);
            s.observe("show", function () {
                o = r.composer.selection.getBookmark();
                r.editor.fire("show:dialog", {command: n, dialogContainer: i, commandLink: t})
            });
            s.observe("save", function (e) {
                if (o) {
                    r.composer.selection.setBookmark(o)
                }
                r._execCommand(n, e);
                r.editor.fire("save:dialog", {command: n, dialogContainer: i, commandLink: t})
            });
            s.observe("cancel", function () {
                r.editor.focus(false);
                r.editor.fire("cancel:dialog", {command: n, dialogContainer: i, commandLink: t})
            })
        }
        return s
    }, execCommand: function (e, t) {
        if (this.commandsDisabled) {
            return
        }
        var n = this.commandMapping[e + ":" + t];
        if (n && n.dialog && !n.state) {
            n.dialog.show()
        } else {
            this._execCommand(e, t)
        }
    }, _execCommand: function (e, t) {
        this.editor.focus(false);
        this.composer.commands.exec(e, t);
        this._updateLinkStates()
    }, execAction: function (e) {
        var t = this.editor;
        switch (e) {
            case"change_view":
                if (t.currentView === t.textarea) {
                    t.fire("change_view", "composer")
                } else {
                    t.fire("change_view", "textarea")
                }
                break
        }
    }, _observe: function () {
        var e = this, t = this.editor, r = this.container, i = this.commandLinks.concat(this.actionLinks), o = i.length, u = 0;
        for (; u < o; u++) {
            s.setAttributes({href: "javascript:;", unselectable: "on"}).on(i[u])
        }
        s.delegate(r, "[data-wysihtml5-command]", "mousedown", function (e) {
            e.preventDefault()
        });
        s.delegate(r, "[data-wysihtml5-command]", "click", function (t) {
            var n = this, r = n.getAttribute("data-wysihtml5-command"), i = n.getAttribute("data-wysihtml5-command-value");
            e.execCommand(r, i);
            t.preventDefault()
        });
        s.delegate(r, "[data-wysihtml5-action]", "click", function (t) {
            var n = this.getAttribute("data-wysihtml5-action");
            e.execAction(n);
            t.preventDefault()
        });
        t.observe("focus:composer", function () {
            e.bookmark = null;
            clearInterval(e.interval);
            e.interval = setInterval(function () {
                e._updateLinkStates()
            }, 500)
        });
        t.observe("blur:composer", function () {
            clearInterval(e.interval)
        });
        t.observe("destroy:composer", function () {
            clearInterval(e.interval)
        });
        t.observe("change_view", function (t) {
            setTimeout(function () {
                e.commandsDisabled = t !== "composer";
                e._updateLinkStates();
                if (e.commandsDisabled) {
                    s.addClass(r, n)
                } else {
                    s.removeClass(r, n)
                }
            }, 0)
        })
    }, _updateLinkStates: function () {
        var n = this.composer.element, o = this.commandMapping, u = this.actionMapping, a, f, l, c;
        for (a in o) {
            c = o[a];
            if (this.commandsDisabled) {
                f = false;
                s.removeClass(c.link, r);
                if (c.group) {
                    s.removeClass(c.group, r)
                }
                if (c.dialog) {
                    c.dialog.hide()
                }
            } else {
                f = this.composer.commands.state(c.name, c.value);
                if (e.lang.object(f).isArray()) {
                    f = f.length === 1 ? f[0] : true
                }
                s.removeClass(c.link, t);
                if (c.group) {
                    s.removeClass(c.group, t)
                }
            }
            if (c.state === f) {
                continue
            }
            c.state = f;
            if (f) {
                s.addClass(c.link, r);
                if (c.group) {
                    s.addClass(c.group, r)
                }
                if (c.dialog) {
                    if (typeof f === "object") {
                        c.dialog.show(f)
                    } else {
                        c.dialog.hide()
                    }
                }
            } else {
                s.removeClass(c.link, r);
                if (c.group) {
                    s.removeClass(c.group, r)
                }
                if (c.dialog) {
                    c.dialog.hide()
                }
            }
        }
        for (a in u) {
            l = u[a];
            if (l.name === "change_view") {
                l.state = this.editor.currentView === this.editor.textarea;
                if (l.state) {
                    s.addClass(l.link, i)
                } else {
                    s.removeClass(l.link, i)
                }
            }
        }
    }, show: function () {
        this.container.style.display = ""
    }, hide: function () {
        this.container.style.display = "none"
    }})
})(wysihtml5);
(function (e) {
    var t;
    var n = {name: t, style: true, toolbar: t, autoLink: true, parserRules: {tags: {br: {}, span: {}, div: {}, p: {}}, classes: {}}, parser: e.dom.parse, composerClassName: "wysihtml5-editor", bodyClassName: "wysihtml5-supported", stylesheets: [], placeholderText: t, allowObjectResizing: true, supportTouchDevices: true};
    e.Editor = e.lang.Dispatcher.extend({constructor: function (t, r) {
        this.textareaElement = typeof t === "string" ? document.getElementById(t) : t;
        this.config = e.lang.object({}).merge(n).merge(r).get();
        this.textarea = new e.views.Textarea(this, this.textareaElement, this.config);
        this.currentView = this.textarea;
        this._isCompatible = e.browser.supported();
        if (!this._isCompatible || !this.config.supportTouchDevices && e.browser.isTouchDevice()) {
            var i = this;
            setTimeout(function () {
                i.fire("beforeload").fire("load")
            }, 0);
            return
        }
        e.dom.addClass(document.body, this.config.bodyClassName);
        this.composer = new e.views.Composer(this, this.textareaElement, this.config);
        this.currentView = this.composer;
        if (typeof this.config.parser === "function") {
            this._initParser()
        }
        this.observe("beforeload", function () {
            this.synchronizer = new e.views.Synchronizer(this, this.textarea, this.composer);
            if (this.config.toolbar) {
                this.toolbar = new e.toolbar.Toolbar(this, this.config.toolbar)
            }
        });
        try {
            console.log("Heya! This page is using wysihtml5 for rich text editing. Check out https://github.com/xing/wysihtml5")
        } catch (s) {
        }
    }, isCompatible: function () {
        return this._isCompatible
    }, clear: function () {
        this.currentView.clear();
        return this
    }, getValue: function (e) {
        return this.currentView.getValue(e)
    }, setValue: function (e, t) {
        if (!e) {
            return this.clear()
        }
        this.currentView.setValue(e, t);
        return this
    }, focus: function (e) {
        this.currentView.focus(e);
        return this
    }, disable: function () {
        this.currentView.disable();
        return this
    }, enable: function () {
        this.currentView.enable();
        return this
    }, isEmpty: function () {
        return this.currentView.isEmpty()
    }, hasPlaceholderSet: function () {
        return this.currentView.hasPlaceholderSet()
    }, parse: function (t) {
        var n = this.config.parser(t, this.config.parserRules, this.composer.sandbox.getDocument(), true);
        if (typeof t === "object") {
            e.quirks.redraw(t)
        }
        return n
    }, _initParser: function () {
        this.observe("paste:composer", function () {
            var t = true, n = this;
            n.composer.selection.executeAndRestore(function () {
                e.quirks.cleanPastedHTML(n.composer.element);
                n.parse(n.composer.element)
            }, t)
        });
        this.observe("paste:textarea", function () {
            var e = this.textarea.getValue(), t;
            t = this.parse(e);
            this.textarea.setValue(t)
        })
    }})
})(wysihtml5)